check if 2 objects are in eachother [message #468148] |
Tue, 29 May 2012 06:02 |
robbyke
Messages: 348 Registered: September 2010 Location: Belgium
Karma: 0
|
Recruit |
|
|
is it possible to check if an object will get stuck if you move it?
my usage is in a gate i move down
i use a zone to test if the harv is in it but when the harv isnt driving straight trough the gate and leave the zone the gate will just go down and stuck the harv sometimes (because of the size of the harv)
also is it possible to test if people die in a zone?
Owner of kambot TT server
kambot.freeforums.org
[Updated on: Tue, 29 May 2012 06:03] Report message to a moderator
|
|
|
Re: check if 2 objects are in eachother [message #468593 is a reply to message #468148] |
Fri, 08 June 2012 02:12 |
|
Whitedragon
Messages: 832 Registered: February 2003 Location: California
Karma: 1
|
Colonel |
|
|
Yes, you can check for collisions like this:
bool Check_Collisions(PhysicalGameObj *obj,const Vector3 &Position) {
if (!obj) {
return false;
}
MoveablePhysClass *Phys = obj->Peek_Physical_Object()->As_MoveablePhysClass();
if (!Phys || (!Phys->As_RigidBodyClass() && !Phys->As_Phys3Class())) {
return false;
}
Matrix3D Transform = Phys->Get_Transform();
Transform.Set_Translation(Position);
return Phys->Can_Teleport(Transform);
}
This will work for characters and moveable vehicles. Won't work on static objects, turrets, etc.
Black-Cell.net
Network Administrator (2003 - )
DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )
Dragonade, Renegade's first server side modification
Lead coder (2005 - )
|
|
|
|
|
Re: check if 2 objects are in eachother [message #469438 is a reply to message #469190] |
Mon, 18 June 2012 08:39 |
|
Jerad2142
Messages: 3811 Registered: July 2006 Location: USA
Karma: 6
|
General (3 Stars) |
|
|
halo2pac wrote on Tue, 12 June 2012 22:03 | Will that check to see if an object is hitting a wall? or trying to go through the ground?
|
The world box actually has to have a collision mesh that crosses though it in order for it to flag true. So saying this is a collision check is misleading, as it won't flag true if two vehicles run into each other, you'd actually have to create or set the position of one inside the other.
Visit Jerad's deer sweat shop
|
|
|