Relative scene node transformations.

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Relative scene node transformations.

Post by Mel »

Something i have noticed while working with Irrlicht is that many times i find myself moving, scaling and rotating an object using a relative transformation, that is, i take the original value for the transform i want to modify, then i add a vector to it, and later, i set it with the proper method.

Wouldn't it be useful to have something like translate/rotate/Scale(vector3d v) methods where the result would be that the positon/rotation/scale is modified according to the current value of the transformation plus the provided vector?
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Relative scene node transformations.

Post by Abraxas) »

I always make a dummy parent scene node for any node that's going to be rotating on 3 axis. Also, you can often to setrotation(getrotation + rotationspeed*frametimer). That's how I made variable-speed spinning rotors in my quad game.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Relative scene node transformations.

Post by Mel »

That is what i mean, couldn't you simply tell the node "rotate(rotationSpeed*frametimer);?

setRotation(getRotation...) is a bit redundant, for me, anyway
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Relative scene node transformations.

Post by Abraxas) »

What you're describing is something like rotation += resultant, which does rotation = rotation + resultant anyway.

There is no way to change a value without reading a value, but I'm under the impression that a function like (getvalue) which reads the memory at a pointer location is EXTREMELY fast.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Relative scene node transformations.

Post by Mel »

it is the diference between 1 and 2 function calls. but for ease of use, it may come in handy.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Abraxas)
Posts: 227
Joined: Sun Oct 18, 2009 7:24 am

Re: Relative scene node transformations.

Post by Abraxas) »

I'm also under the impression that those type of function calls get inlined. If they don't, they should be.
Mel
Competition winner
Posts: 2292
Joined: Wed May 07, 2008 11:40 am
Location: Granada, Spain

Re: Relative scene node transformations.

Post by Mel »

They are defined inside a header file, so they are "auto inlined"... Didn't think of that. Clever, very clever XD
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Post Reply