[no bug]Bug in CCameraSceneNode::setRotation

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
kevin_shanghai
Posts: 28
Joined: Wed Jan 30, 2013 3:29 am

[no bug]Bug in CCameraSceneNode::setRotation

Post by kevin_shanghai »

version 1.8.1

void CCameraSceneNode::setRotation(const core::vector3df& rotation)
{
if(TargetAndRotationAreBound)
Target = getAbsolutePosition() + rotation.rotationToDirection();
//Here , i think it should be like this:
Target = getAbsolutePosition() + rotation.rotationToDirection(Target-getAbsolutePosition());

ISceneNode::setRotation(rotation);
}
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: Bug in CCameraSceneNode::setRotation

Post by hendu »

While both are valid approaches, that would be a behavioral change that would break existing apps.
CuteAlien
Admin
Posts: 9633
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Bug in CCameraSceneNode::setRotation

Post by CuteAlien »

Yeah - rotation is absolute - not relative to current rotation.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kevin_shanghai
Posts: 28
Joined: Wed Jan 30, 2013 3:29 am

Re: [no bug]Bug in CCameraSceneNode::setRotation

Post by kevin_shanghai »

the default parameter is as following:
vector3d<T> rotationToDirection(const vector3d<T> & forwards = vector3d<T>(0, 0, 1))

i don't think, the code i mentioned should use the default.

in my program, the code is absolutely a bug.
CuteAlien
Admin
Posts: 9633
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: [no bug]Bug in CCameraSceneNode::setRotation

Post by CuteAlien »

Well, maybe we can help you with your program. Just to make it clear - what setRotation is doing is setting absolute angles. If you set the rotation to the same value it will always look in the same direction. While with your change that would no longer be the case. You probably want to rotate +/- a certain relative value to the current value. To do that you should add your rotation to the current rotation.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
kevin_shanghai
Posts: 28
Joined: Wed Jan 30, 2013 3:29 am

Re: [no bug]Bug in CCameraSceneNode::setRotation

Post by kevin_shanghai »

thanks!
i will check it out again.
Post Reply