Suppose I have two boxes, the world around is moving and rotating, but the two boxes must stay at a fixed point relatives to each other.
Is there any way to do this?
The truth is I have 4 billboards which should act as a box, rotating and moving around. But it must look like it's only one object. It's basically the same problem as this:
https://www.opengl.org/discussion_board ... s-together
But I have no idea how to do that in irrlicht.
Thanks!
[Solved]Any way to tie two objects together?
[Solved]Any way to tie two objects together?
Last edited by dc740 on Thu Jan 29, 2015 3:24 am, edited 1 time in total.
Re: Any way to tie two objects together?
Create a dummy scene node as parent to the two boxes. Perform all transformations on the dummy node, not on the box nodes. However, using billboards will present difficulties because they always face the camera, so that is a really bad choice. Maybe you could just use planes?
Re: Any way to tie two objects together?
Thanks! I didn't know that. I'll test it ASAP.
About the billboards:
I implemented my own billboards and texture animations. My billboards have an option to face the camera, or simply not. Now that you mention it... would simple planes accept texture animators? It's not that it took me much time, but it would have been easier
my texture animator is basically the same found in irrlicht, but it also adds support to use a texture matrix.
You can find both here:
https://mega.co.nz/#!sVNEjIjD!A5OH1ktI5 ... HMMneIzhaA
The original post:
http://irrlicht.sourceforge.net/forum/v ... =1&t=50480
About the billboards:
I implemented my own billboards and texture animations. My billboards have an option to face the camera, or simply not. Now that you mention it... would simple planes accept texture animators? It's not that it took me much time, but it would have been easier
my texture animator is basically the same found in irrlicht, but it also adds support to use a texture matrix.
You can find both here:
https://mega.co.nz/#!sVNEjIjD!A5OH1ktI5 ... HMMneIzhaA
The original post:
http://irrlicht.sourceforge.net/forum/v ... =1&t=50480
Re: Any way to tie two objects together?
Someone else will have to answer this as I have no experience using texture matrices. However, I believe that Irrlicht actually passes texture matrices to the driver, so you might just try it.
Re: Any way to tie two objects together?
mongoose7 wrote:Someone else will have to answer this as I have no experience using texture matrices. However, I believe that Irrlicht actually passes texture matrices to the driver, so you might just try it.
How odd that it's not supported by default then. I already have my animations and billboards working as I wanted (with and without matrices), so I won't be testing this in the short term. I haven't tried with the parent node YET, but I'm sure I will in a few days once I get a little time.
Thanks!
Re: Any way to tie two objects together?
Solved. I was setting the billboard RELATIVE position to itself off from the center instead of setting the billboard absolute position in the world. So the rotation was completely messed up
Now it rotates as expected.
By the way, this is my render method for the multi-purpose billboard (static and follow-camera), please tell me ifyou see anything wrong with it (mainly because I'm a newbie and I want to learn):
Now it rotates as expected.
By the way, this is my render method for the multi-purpose billboard (static and follow-camera), please tell me ifyou see anything wrong with it (mainly because I'm a newbie and I want to learn):
Code: Select all
//! render
void StaticBillboardSceneNode::render()
{
irr::video::IVideoDriver* driver = SceneManager->getVideoDriver();
irr::scene::ICameraSceneNode* camera = SceneManager->getActiveCamera();
if (!camera || !driver)
return;
if (followCamera){
irr::core::vector3df campos = camera->getAbsolutePosition();
irr::core::vector3df target = camera->getTarget();
setOrientation(target - campos);
driver->setTransform(irr::video::ETS_WORLD, irr::core::IdentityMatrix);
} else {
driver->setTransform(irr::video::ETS_WORLD, AbsoluteTransformation);
}
driver->setMaterial(Material);
driver->drawIndexedTriangleList(vertices, 4, indices, 2);
}