Hey,
I need help with this, I can’t get it to work correctly, if I disable 2 axes, then its working but I am really looking to have the 3 axes…
My goal is to rotate around a point on a virtual sphere; the cone should point at the cube or at least move symmetric with it.
Here the code:
I need help with this, I can’t get it to work correctly, if I disable 2 axes, then its working but I am really looking to have the 3 axes…
My goal is to rotate around a point on a virtual sphere; the cone should point at the cube or at least move symmetric with it.
Here the code:
Graphics3D 800,600, 16,2 Cam = CreateCamera() : PositionEntity Cam,0,0,-20 : ;RotateEntity Cam,50,0,0 Light = CreateLight() : PositionEntity Light,20,30,-20 CenterMesh = CreateCone() CenterPitchAdd# = 1 ; Can be changed CenterYawAdd# = 1 ; Can be changed CenterRollAdd# = 1 ; Can be changed AwayMesh = CreateCube() PxR# = 0 ; Can be changed PyR# = 5 ; Can be changed PzR# = 0 ; Can be changed Repeat TurnEntity CenterMesh,CenterPitchAdd#, CenterYawAdd#, CenterRollAdd# ;pitch# = EntityPitch#(CenterMesh) ;Yaw# = EntityYaw#(CenterMesh) ;roll# = EntityRoll#(CenterMesh) pitch# = pitch# + CenterPitchAdd# Yaw# = Yaw# + CenterYawAdd# roll# = roll# + CenterRollAdd# ;------------ CODE -------------- Px# = PxR# Py# = PyR#*Cos(pitch#) - PzR#*Sin(pitch#) Pz# = PyR#*Sin(pitch#) + PzR#*Cos(pitch#) Px# = Px#*Cos(roll#) - Py#*Sin(roll#) Py# = Px#*Sin(roll#) + Py#*Cos(roll#) Pz# = Pz# Px# = Px#*Cos(Yaw#) - Pz#*Sin(Yaw#) Py# = Py# Pz# = Px#*Sin(Yaw#) + Pz#*Cos(Yaw#) ;------------ CODE -------------- PositionEntity AwayMesh, Px#, Py#, Pz# ; <----- TEST RenderWorld Text 0,10, Px# Text 0,20, Py# Text 0,30, Pz# Text 0,40, "---------" Text 0,50, pitch# Text 0,60, Yaw# Text 0,70, roll# Flip Until KeyHit(1)