SceneNode improvements idea

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply

Is this a good idea?

Yes
5
63%
No
3
38%
 
Total votes: 8

Bot_Builder
Posts: 23
Joined: Thu Apr 14, 2005 6:59 pm
Location: Bushland

SceneNode improvements idea

Post by Bot_Builder »

I dont have code because so far I've been reluctant to dive into recompiling irrlicht, however, I think a few methods could be added to ISceneNode. Most of them, not suprisingly are inspired by Blitz3d's engine, which frankly is much mroe user friendly. :wink:

Code: Select all

virtual void translate(const core::vector3df &amount) //add this vector to current position
virtual void move(const core::vector3df &amount) //translate relative to node's rotation
virtual core::vector3df transform(const core::vector3df & vec, const scene::ISceneNode to=0)  //transforms a vector from the node to the "to" node.
Oh, and it'd be nice if functions such as the above with vectors as parameters were overloaded to take three floats instead.

[edit]Oh, and I just noticed the dev-c++ tutorial link in the tutorials section... it should really be at the top, since when i learned a few days ago I attempted to adapt the helloworld visual C++ tutorial, and ran into problems.

Some commands for rotation:

Code: Select all

virtual void Turn(const core::vector3df &degrees) //Turns relative to the current orientation
virtual void Orient(const core::vector3df &degrees) //Basically, the same as turn but not relative to the current rotation.
Last edited by Bot_Builder on Mon Apr 18, 2005 10:43 pm, edited 1 time in total.
buhatkj
Posts: 444
Joined: Fri Dec 12, 2003 4:53 am
Contact:

perhaps...

Post by buhatkj »

I can see the value perhaps in the move() one, since that might be a little tricky to implement yourself, but the other I would question how necessary they really are, or in some cases would wonder if this was redundant.

Transform() for instance from your description seems the same as setPosition()

translate() would be as easy as this(pseudocode sort of...):

Code: Select all

translateBy(core::vector3df trans){
	node->setPosition((node->getPosition() + trans));
}
turn is the same as above, but for rotation, and orient seems redundant to setRotation()

just some thought observations on this...
My irrlicht-based projects have gone underground for now, but if you want, check out my webcomic instead! http://brokenboomerang.net
Bot_Builder
Posts: 23
Joined: Thu Apr 14, 2005 6:59 pm
Location: Bushland

Post by Bot_Builder »

Yeah, translate and turn should be pretty simple, although gimbol lock and fixing wrapping might take a bit of effort to get right.

I'm probably not explaining Transform correctly. Basically you give it a vector in one node's space and have it translated into another's. So, you could apply this method to the player with vector3df(0,0,5), and leave to at 0 (absolute position) and it would give you the absolute position of a point 5 units in front of your player. This command was exceedingly useful. I believe there was 3 variations in Blitz3d... One for points (like this func), one for vectors, that only takes into accout orientation not position of the nodes, and one for normals which is like vectors but normalizes afterwords. How about two of them? TransformPoint and TransformVector. I'm sure with irrlicht's vector class you could also normalize rather easily.

One more command I've remembered that was VERY handy, especially if you write your own custom physics:

Code: Select all

virtual void AlignToNormal(const int axis, const vector3df normal) //In bb3d called AlignToVector, but I figured it calculates normal at some point anyway

For some perhaps better explanations check out http://www.blitzbasic.com/b3ddocs/command_list_3d_cat.php?show=Entity%20Movement
ImageXP SP2, AMD Athlon 64 3500+, 1GB HyperX RAM, Radeon X700 Pro (PCI-e), 120GB SATA drive :)
SARIN
Posts: 139
Joined: Fri Oct 29, 2004 3:53 am

Post by SARIN »

sure, that would make it easier, but why add them in? the translation and rotation ones are already solved, thats wat the operator+ is for! for the move, that has been answered so many time in the forums, but for a simple bit

Code: Select all

vector3df pos=node->getPosition();
vector3df angle=node->getRotation();
pos.X+=speed.X+5*sin(angle.Y);
pos.Y+=speed.Y+5*sin(angle.X);
pos.Z+=speed.Z+5*cos(angle.Y);
Bot_Builder
Posts: 23
Joined: Thu Apr 14, 2005 6:59 pm
Location: Bushland

Well, yeah...

Post by Bot_Builder »

Well, I know how to do them, its all rather simple except for orient and aligntovector. Might as well add them, because convenience is what an engine is all about. You could also, for instance, do it all raw openGL or raw DirecTX code. But instead, we choose to use an engine. Why? Convenience. And these convenience functions are very, very handy and if they were added would avoid all those noobs asking how to do something. Note that I'm not asking how to do them, just requesting implementation. With a proper canonization function (limits and wraps the values of the euler angles), turn should be easy. Translate is very easy, however not so obvious to the nooby - I forgot that the + operator was overloaded and did it element by element. which technically is faster. Move is moderate - every non-mathy nooby is gonna ask, so it should be implemented as a method. Transform simply requires multiplying by the transpose of one matrix and another, normal matrix (go down to absolute position, back up to a local space). Depends on the node system though. TransformVector/Point may need to go up the matrix stack until it hits a common matrix, and back down again to the target coordinate system.

The more user friendly the engine is, the more people will use it.
ImageXP SP2, AMD Athlon 64 3500+, 1GB HyperX RAM, Radeon X700 Pro (PCI-e), 120GB SATA drive :)
Post Reply