rotating an object around a certain point

Just starting out? Need help? Post your questions and find answers here.
bernardfrancois
User
User
Posts: 47
Joined: Tue Sep 02, 2003 9:17 am
Location: Belgium
Contact:

rotating an object around a certain point

Post by bernardfrancois »

hello,

is it possible to rotate a 3d object around a certain point, and not around it's center?
coldarchon
New User
New User
Posts: 4
Joined: Tue Aug 19, 2003 10:34 am

Post by coldarchon »

are you talking about a distance or a track algorithm?
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

You could use a little math and use Sin() and Cos() to plot a circular path around a point.
--Kale

Image
bernardfrancois
User
User
Posts: 47
Joined: Tue Sep 02, 2003 9:17 am
Location: Belgium
Contact:

Post by bernardfrancois »

I tried to do that, but there's something wrong with my procedure:

Procedure RotateParticleEmitterArround(emitter,xpos,ypos,zpos,xrot,yrot,zrot)
xdelta=Abs(ParticleEmitterX(emitter)-xpos)
ydelta=Abs(ParticleEmitterY(emitter)-ypos)
zdelta=Abs(ParticleEmitterZ(emitter)-zpos)
; X rotation
ymov=Sin(xrot)*ydelta
zmov=Cos(xrot)*zdelta
; Y rotation
zmov=Sin(yrot)*zdelta
xmov=Cos(yrot)*xdelta
; Z rotation

RotateParticleEmitter(emitter,xrot,yrot,zrot)
MoveParticleEmitter(emitter,xmov,ymov,zmov)
EndProcedure


anyone who sees what's my mestake?
Post Reply