Vehicle item collisions
by Chris Norpchen · in Torque Game Engine · 05/27/2004 (4:10 pm) · 7 replies
Has anyone found a fix for getting vehicles to be able to collide with items??? Even if you add the ItemObject type to the vehicle collision mask set it still does not collide with the item??
I found an older previous post on this (Item Collision) where people talked about this, but the final word was that it (adding ItemObject type to the vehicles collision mask) doesn't work with vehicle/item collisions...
I am going to try to do some sort of hack in the onCollision event within the item, because that does work. But, would like to know if there is a more correct way for this.
I found an older previous post on this (Item Collision) where people talked about this, but the final word was that it (adding ItemObject type to the vehicles collision mask) doesn't work with vehicle/item collisions...
I am going to try to do some sort of hack in the onCollision event within the item, because that does work. But, would like to know if there is a more correct way for this.
About the author
#2
The items collision works perfectly when I add them as static shape objects, but fail to work at all when brought in as items.
I have been at all types of post on the forums, but many are old. I have added ItemObject class to the WheeledVehicle collision mask (which is supposed to make it collidable) but that hasn't worked. Also, I have set the items mCollideable = true in both script and C++.
I am continueing to search for an answer in C++ and script.
05/28/2004 (8:34 pm)
Yes, it does have a collision mesh, and it is convex. Actually some itmes have just a simple bounding box (tripled of course) for a collision mesh.The items collision works perfectly when I add them as static shape objects, but fail to work at all when brought in as items.
I have been at all types of post on the forums, but many are old. I have added ItemObject class to the WheeledVehicle collision mask (which is supposed to make it collidable) but that hasn't worked. Also, I have set the items mCollideable = true in both script and C++.
I am continueing to search for an answer in C++ and script.
#3
IMPLEMENT_CO_NETOBJECT-V1
Item::Item()
{
mTypeMask... blah blah bunch of variables and then
mCollisionObject = 0;
mCollisionTimeout = 0;
Anyone know why these are set to 0??? They seem to be checked quite often in the coding for Item collision. Rather then checking mIsCollideable they seem to check mCollisionObject to see if there is a collision object. But if it is set to 0, then there isn't one??? I am new at coding, but when I tried to set this to 1 I got a compilling error. I don't know if this could be the problem with item/vehicle collision or not.
Has anyone figured out how to get items to collide with vehicles???
05/29/2004 (12:39 pm)
After looking through the Item.cc code I noticed thisIMPLEMENT_CO_NETOBJECT-V1
Item::Item()
{
mTypeMask... blah blah bunch of variables and then
mCollisionObject = 0;
mCollisionTimeout = 0;
Anyone know why these are set to 0??? They seem to be checked quite often in the coding for Item collision. Rather then checking mIsCollideable they seem to check mCollisionObject to see if there is a collision object. But if it is set to 0, then there isn't one??? I am new at coding, but when I tried to set this to 1 I got a compilling error. I don't know if this could be the problem with item/vehicle collision or not.
Has anyone figured out how to get items to collide with vehicles???
#4
I know that sounds odd but it is an important distinction =)
06/01/2004 (1:05 pm)
Wait...do you want Vehicles to collide with Items or Items to collide with Vehicles?I know that sounds odd but it is an important distinction =)
#5
06/01/2004 (1:51 pm)
I have an anti vehicle mine that is an item and it collides with vehicles just fine.
#6
06/01/2004 (2:17 pm)
Yeah, what are you trying to do? Just write the code in the item onCollision, that one is called less then the vehicle onCollision (its less likely to collide, other then with a vehicle, while a vehicle collides with things all the time), so its a better solution anyway (if you ask me).
#7
Josh, Does you mine actually stop the vehicle from passing through it or does it just register a onCollision, because I have no problem registering an onCollision, but I cannot get the Vehicle to stop passing through the object.
Ward, I am trying to have a vehicle collide with an item just like it would a static shape (like an obstical) where it cannot pass through it. I may be able to put somethign in the onCollision of the item, and maybe have it reverse or stop the vehicle's velocity, but that would mean working out how torque handles the vehicle velocity and movement. I know it handles the vehicle movement and collision differently than a regular player. Also, I don't know if doing it in the Item::onCollision would cause any other problems elsewhere.
I think I may just go with static objects and add onto there code to get them to do what I want instead of items because their collision seems to work fine. Would be nice if vehicle/item collision worked correctly when you add the itemObject type to the wheeledvehicle collision mask though...
06/02/2004 (7:38 am)
Matthew, I am trying to have Vehicles collide with items.Josh, Does you mine actually stop the vehicle from passing through it or does it just register a onCollision, because I have no problem registering an onCollision, but I cannot get the Vehicle to stop passing through the object.
Ward, I am trying to have a vehicle collide with an item just like it would a static shape (like an obstical) where it cannot pass through it. I may be able to put somethign in the onCollision of the item, and maybe have it reverse or stop the vehicle's velocity, but that would mean working out how torque handles the vehicle velocity and movement. I know it handles the vehicle movement and collision differently than a regular player. Also, I don't know if doing it in the Item::onCollision would cause any other problems elsewhere.
I think I may just go with static objects and add onto there code to get them to do what I want instead of items because their collision seems to work fine. Would be nice if vehicle/item collision worked correctly when you add the itemObject type to the wheeledvehicle collision mask though...
Associate Matt Fairfax
PopCap