Rotating vertices

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
realmsinthemists
Posts: 28
Joined: Mon Mar 27, 2017 7:29 am

Rotating vertices

Post by realmsinthemists »

Have this problem to sort out but I haven't got much of a clue so I'll think out loud. They're two separate things but I think both need to use matrices.

In the scene there are two scenenodes. One contains a procedural mesh and the other can be anything. The procedural I'll call CProcedural and the other CTarget.

CProcedural contains a mesh which is a plane, vector3df(0,1,0) at position vecor3df(0,radius,0). Then all verts are normalized() * radius; This makes it a part of a quadsphere.

Q 1: CTarget is a node that moves around. Currently it has a quick but messy setUp( getPosition().normalized() ) thingy to simulate it is moving around a sphere. It has a gimbal lock and should get rid of that.
Q 1.1: CTarget's position needs to be converted to a rotation. How could this be done?

Q 2: CProcedural needs to be able to rotate its plane locally so it will be on the infinite line (0,0,0) - CTarget::getPosition(). The node shouldn't rotate at all.
Currently CTarget is a develop camera controller but all objects within the scene needs to have the same behaviour. Don't think this will matter but maybe it does so I'd like to note. CProcedural will always 'center' at the camera.

r,

A2: Still thinking out loud

Code: Select all

 
// To just rotate it with a given rotation in degrees (Was I that scared for this? Probably the reason why matrix isn't spelled like BOO)
core::matrix4   rotationMatrix;
rotationMatrix.setRotationDegrees( core::vector3df( 0, 0, 90 ) );
 
core::vector3df vIn( -2.5f, 2.5f, -2.5f );
core::vector3df vOut;
 
rotationMatrix.rotateVect( vOut, vIn );
 
For my end result I am working on:
- Volume Voxel System
- Simple light weight physics engine
Post Reply