Rotation doesnt affect origin

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Rotation doesnt affect origin

Post by MasterM »

Hey all, i have a 3d car that can move,rotate,etc but when i rotate the 3d car
and move it forward it doesn't move forward in the direction the rotation is and resulting in a very strange car.
So i ask how do i rotate the car and the origin of it at the same time?
Thanks in advance.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

This has been answered a ridiculous number of times. Please use the search function at the top of your screen.
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

I searched but i did not get anything that helped me, if you know a good link pleas give it to me.
Thanks in advance.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

You lied to me! I feel... violated.

I need to go and lie down now, and deal with the shock. It'll be difficult to trust you after this, but... I'll try counselling if you will.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
cdrwolfe
Posts: 100
Joined: Thu Nov 15, 2007 5:38 pm
Location: Cranfield University

Post by cdrwolfe »

rogerborg wrote:You lied to me! I feel... violated.

I need to go and lie down now, and deal with the shock. It'll be difficult to trust you after this, but... I'll try counselling if you will.
Your a Scot aren't you, you should be used to it by now :)

Regards Wolfe
rogerborg
Admin
Posts: 3590
Joined: Mon Oct 09, 2006 9:36 am
Location: Scotland - gonnae no slag aff mah Engleesh
Contact:

Post by rogerborg »

We never learn though.

Scotchmen: Right, Frenchies, are you up for getting stuck into the English?
Frenchies: Oui.
Scotchmen: For real this time? We'll invade from the North, you come from the South?
Frenchies: Oui.
Scotchmen: OK, we're about to go. Are you definitely going to join in this time?
Frenchies: Oui.
Scotchmen: Promise?
Frenchies: Oui.
Scotchmen: FREEEEEEEEEDOM! CHAAAAR- wait... are you invading or not?
Frenchies: (shrug) Non.
Scotchmen: (charge into a swamp and get bayoneted - again)

How many times?
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

I did not lie to you...
The car is moving fine but the orgin doesnt change...
I swear i did not lie to you.
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

rogerborg wrote:Brilliant! Have you got framerate independent motion, and movement in the correct direction working OK?
MasterM wrote:Yup, its working in the correct direction
Also, I found another answer for you in that very same thread.
rogerborg wrote: Then, as the model rotates, the forwards (and backwards) direction changes, and you'll want to calculate that direction and then add it to - or subtract it from - the model's position when it moves forwards and backwards.

To get the forwards direction, you can either use trig, matrix methods, or if you've got the latest SVN code (as I recommend because of the getTime() issue on Windows) then you can use the new vector3df::rotationToDirection() utility method to create a forwards vector directly from the node's rotation.
Deja vu, eh? :lol:

I think the fundamental problem here is that the origin is only a point, not a rotation. When you rotate a node, it will rotate around it's origin, but there is no "rotation" of the origin to be changed. You yourself have to manually calculate which direction to move the node to achieve movement in the correct manner; refer to either what rogerborg said in the last topic (as I have conveniently quoted above) or the link to the topic I posted earlier.
MasterM
Posts: 128
Joined: Sat Oct 20, 2007 2:38 am
Location: netherlands antilles, Curacao

Post by MasterM »

I still dont see why i lied, really i dont :S
C++ is not the Magdalena...it takes patience...shes like the well aged prostitute, it takes years to learn her tricks! she is cruel...laughs at you when you are naked...
Life of a programmer == Const abuse
rooly
Posts: 224
Joined: Tue Oct 25, 2005 4:32 pm
Location: Louisiana, USA, backwater country
Contact:

Post by rooly »

To get what you want, you'll need a minorly-complex mathematical calculation to have your car travelling "forward" in relation to it's rotation.

irrlicht can most correctly be called a 3d rendering engine, as opposed to a game engine. for this matter, irrlicht does not store the "forward" orientation itself. this is up to you.

the way i like to do it, is to use a class that acts as a container for a group of nodes:

ISceneNode* parent, mesh, transform;

set the mesh and transform's parent as "parent".
when moving, set the parent's position to the transform's absolute position. then reset the transform's position to (0,0,0)

when rotating, set the parent's rotation to the transform's absolute rotation, then reset the transform's rotation to (0,0,0)

parent and transform should both be init'ed with addEmptySceneNode()


Now. i've just given you so much free information, i would be shot by the intellectual property cops. don't bug me unless you get on IRC
When banks compete, you win.
When ISPs compete, you win.
When electronics retailers compete, you win.
When governments compete...you get drafted.
Dark_Kilauea
Posts: 368
Joined: Tue Aug 21, 2007 1:43 am
Location: The Middle of Nowhere

Post by Dark_Kilauea »

psst...

I would just use a physics library, since it seems you are going for a car racing game
rogerborg wrote:Every time someone learns to use a debugger, an angel gets their wings.
Post Reply