HI,
i am still confused with collision code.
i have camera and faerie. what i want is after the camera through the faerie, faerie get lost (faerie->setVisible(false)).
have any idea?
thx.
ijo coim
collision camera and model, model->setVisible(false)
Simplest way would be to use distance rather than collision. Something like this:
Set the distance to whatever the collision radius is. This way you don't need to worry about messing with collisions.
Code: Select all
vector3df cameraPosition = cameraNode.getPosition();
f32 distance = cameraPosition.getDistanceFrom(faerie.getPosition());
if (distance < 80.0f)
{
faerie->setVisible(false);
}
it work
hey, it work.
thx guest.
when i compile the program, the faerie get lost (faerie->setVisible(false).
from here, i know if the code is work.
now, i must make a funtion, if the camera come to faerie, faerie get lost.
thx once again guest.
ijo coim.
thx guest.
when i compile the program, the faerie get lost (faerie->setVisible(false).
from here, i know if the code is work.
now, i must make a funtion, if the camera come to faerie, faerie get lost.
thx once again guest.
ijo coim.
it really2 work
guest, it really2 work. i use a boolean function to test this code. maybe another can use this code too. here it is :
1.declare an bool
2. in event receiver, make the bool work, if right click is click:
3.tell the device
4. in loop, give the GUEST'S code :
thx.
regards,
ijo coim
1.declare an bool
Code: Select all
bool tabrak_2=false;
Code: Select all
class MyEventReceiver : public IEventReceiver{
public :
virtual bool OnEvent(SEvent event){
if(event.EventType==irr::EET_MOUSE_INPUT_EVENT &&
event.MouseInput.Event==EMIE_RMOUSE_PRESSED_DOWN)
{
tabrak_2=!tabrak_2;
return true;
}
return false;
}
}
;
Code: Select all
MyEventReceiver terima;
IrrlichtDevice *device =
createDevice(driverType, core::dimension2d<s32>(512, 384), 16, false,false,false,&terima);
Code: Select all
while(device->run())
if (device->isWindowActive())
{
driver->beginScene(true, true, 0);
smgr->drawAll();
if(tabrak_2)
{
// buat tabrakan dengan mesh dan kamera
vector3df cameraPosition = node_coba->getPosition();
f32 distance = cameraPosition.getDistanceFrom(node_coba->getPosition());
if (distance < 10.0f)
{
node_coba->setVisible(false);
}
}
.
.
.
regards,
ijo coim