Purebasic probleme du choix sphere ou cube

Fermé
dream666 Messages postés 735 Date d'inscription mardi 8 juillet 2008 Statut Membre Dernière intervention 24 février 2014 - 3 août 2009 à 16:04
Bonjour,

j'arrive a creer des spheres dans le monde 3D, je peux les placer et les retailler comme je le veux et en mettre autan que je le veux. Maintenant je cherche a creer des cube mai mon probleme c'est que je n'arive qu'a selectionner le cube pour tout objet3d creer, l'etat des objet3d ne sont pas memoriser comme les emplacement, la taille ou la rotation. cela fait 1jour que je cherche et j'avance plus

voici un partie du code source où il y a le probleme :

If KeyboardPushed(#PB_Key_Pad1)
objet3d=0

EndIf
If KeyboardPushed(#PB_Key_Pad2)
objet3d=1

EndIf





;permet la creatuion de l'objet 3d
b=b+c
For a=0 To b


CreateEntity(a, MeshID(Tableau()\objet3d) , MaterialID(0))

EntityMaterial(a, MaterialID(0))


;ajoute une nouvelle ligne au tableau pour memoriser les diferente valeur enplacement, taille ,rotation ect
AddElement(Tableau())
Tableau()\numero = a
Tableau()\sphere_x = 0
Tableau()\sphere_y = 0
Tableau()\sphere_z = 0
Tableau()\taille_x = 0
Tableau()\taille_y = 0
Tableau()\taille_z = 0
Tableau()\rotation_obj_3D_x=0
Tableau()\rotation_obj_3D_y=0
Tableau()\rotation_obj_3D_z=0
Tableau()\objet3d =objet3d


Next a


;affiche chaque objet 3d precedement creer en fonction des valeurs enregistrer dans le tableau
For d=0 To b
If a>d
SelectElement(Tableau(), d)

EntityLocate(d, Tableau()\sphere_x, Tableau()\sphere_y, Tableau()\sphere_z)
ResizeEntity(d, Tableau()\taille_x, Tableau()\taille_y, Tableau()\taille_z)
RotateEntity(d, Tableau()\rotation_obj_3D_x+angle_sphere_x, Tableau()\rotation_obj_3D_y+angle_sphere_y, Tableau()\rotation_obj_3D_z+angle_sphere_z)

EndIf
Next d



;declenche un nouveau objet3d mai memorise avant les valeurs de lobjet qui vien d'etre modifier
If KeyboardPushed(#PB_Key_Space) And KeyboardPushed(#PB_Key_S)

Tableau()\numero = a-1
Tableau()\sphere_x = Mesh_x
Tableau()\sphere_y = Mesh_y
Tableau()\sphere_z = Mesh_z
Tableau()\taille_x = 1+size_x/150
Tableau()\taille_y = 1+size_y/150
Tableau()\taille_z = 1+size_z/150
Tableau()\rotation_obj_3D_x=rotation_obj_3D_x
Tableau()\rotation_obj_3D_y=rotation_obj_3D_y
Tableau()\rotation_obj_3D_z=rotation_obj_3D_z
Tableau()\objet3d =objet3d

c=1
Delay(100)
ElseIf KeyboardPushed(#PB_Key_Space) And KeyboardPushed(#PB_Key_W)
a=a-1
b=b-1
FreeEntity(a)
Delay(100)
Else
c=0
EndIf