Trigger Volumes

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Trigger Volumes

Postby pHySiQuE » Tue Jul 24, 2012 10:23 pm

1. What is the difference between a regular collision and a trigger volume? Is it simply that trigger volumes don't generate the individual contacts?

2. Is there a way to make a real volume trigger, that continually generates collisions when an object is inside it? Consider a door with a trigger volume around it. When a player hits the outside of the volume, the door opens. If the player enters the volume, the door will close again after a few seconds, because the trigger isn't being hit. Is there any way to make the trigger test for a body completely inside it?
Untitled 2.png
Untitled 2.png (3.69 KiB) Viewed 5553 times
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Trigger Volumes

Postby pHySiQuE » Tue Jul 24, 2012 11:27 pm

I think this can be achieved with NewtonCollisionClosestPoint().
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Trigger Volumes

Postby Julio Jerez » Wed Jul 25, 2012 9:09 am

here is the status of Trigger volumes
Code: Select all
inline bool dgCollisionInstance::IsTriggerVolume() const
{
   return m_isTriggerVolume ? true : false;
}

inline void dgCollisionInstance::SetAsTriggerVolume(bool mode)
{
   _ASSERTE (0);
}


They are going to be revamped after I go over the destrution.

however a trigger volome can not work the way to say, They do not generate contacts.
my interpretation of a trigger volome is a region os space ther work as a bollean variable that is on if a in object is inside or partially inside teh volume or zero when it is outside.

The use teh same fuintiosn fo teh collsion system bu the do no calculate contacts, this is what make them fast
you can do any operation you want at the higher level using the state of the trigger including calculating the contacts using the volume itself and the object inside the volume

for what you say above, I beleive teh behaviod I descricrve completle solves the problem. no need for caculetion contacts unless you wna to know teh exact location of teh triget volume that was hit.
all you need to do is have a memory in yot actor that save teh current state of the trigger

something like this
Code: Select all
state1 = ColleionGetTriggerState();

if (!state0 & state1) {
   //the actor hit teh trigger for the first time, do anythong (open door)
}
state0 = state1;


you could do that with collisions and material and callback for trigger, but it will be much elegant whne the trigger funtionality is in
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Trigger Volumes

Postby carli2 » Wed Jul 25, 2012 12:08 pm

Julio Jerez wrote:here is the status of Trigger volumes
Code: Select all
inline bool dgCollisionInstance::IsTriggerVolume() const
{
   return m_isTriggerVolume ? true : false;
}

inline void dgCollisionInstance::SetAsTriggerVolume(bool mode)
{
   _ASSERTE (0);
}


Why did you tell us to use Newton 3?
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Trigger Volumes

Postby Julio Jerez » Wed Jul 25, 2012 12:16 pm

because those are features that are very specific that not too many people use, plus they are trivial to implement.
In core 200 the trigger was never a good feature to begin with, basically you had to use a full body just for a trigger, now they can be part of a scene collision or a compound collison and still act as a trigger

I did not trick to try newton 300, the standard funtionalities of the engine is fully funtional.
A trigger is no a new funtionality, it is simple a collision mode for a shape tha is usfull when contact are not relevant.
This can be achived with material callbacks. I added because a callback can no prevent the contact calculation but a flag in the collsion can tell the engine not to do that.
You still need to use the call back or quierie the contact joint to get the collision status of the trigger.

each time some one ask for a functionality I do the best I can do help there is not need for that.
I can make the trigget demo over the weekend.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Trigger Volumes

Postby carli2 » Wed Jul 25, 2012 2:17 pm

Julio Jerez wrote:I did not trick to try newton 300, the standard funtionalities of the engine is fully funtional.


ConvexCast behaves differently. I have to rework all my character controller code. ConvexCast returns 0 when a body has contacts (no matter in which direction)

Julio Jerez wrote:each time some one ask for a functionality I do the best I can do help there is not need for that.
I can make the trigget demo over the weekend.

The trigger volume feature is available to the script. (I'm using NewtonCollisionSetAsTriggerVolume) but it is not used by the game yet. The trigger volume thing is good for mini games. So we will maybe use it in the future.
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Trigger Volumes

Postby pHySiQuE » Fri Jul 27, 2012 1:21 pm

I just call NewtonCollisionClosestPoint() for trigger volumes in the NewtonOnAABBOverlap() function, and if the shapes intersect I record a collision, then return 0 so Newton doesn't calculate collisions itself. It works perfectly.
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Trigger Volumes

Postby Julio Jerez » Fri Jul 27, 2012 2:04 pm

you see the functionality is all there. bascially this is more or less what I will do. Most those feacturer are just formalization
of some internal functionality that is already there.

I will try to complete a trigger demo. a big cilynder set as a trigger, tha will be use as a physics vavirable to apply an extra force to any ovjhect that is inside the trigger. I will try to apply some coriolis preasure to simulate a mini tornado.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Trigger Volumes

Postby pHySiQuE » Fri Jul 27, 2012 4:06 pm

I don't even know if you need to implement anything else since the functionality is already there. I love Newton. :D
pHySiQuE
 
Posts: 608
Joined: Fri Sep 02, 2011 9:54 pm

Re: Trigger Volumes

Postby carli2 » Mon Aug 06, 2012 8:31 am

Okay,
we're using trigger volumes for the RPG now, so the time has come that we need it.

OffTopic:
We delayed switching to newton3 because of problems with the character controller.
The CharacterController uses ConvexCast and SetMatrix. I don't know if that creates contacts or not, but ConvexCast tells me I cannot move the object in the opposite direction of the ground when it lays on the ground.
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Trigger Volumes

Postby Julio Jerez » Mon Aug 06, 2012 11:18 am

I am doing some work on the collsion now, I can take a look and enabling that triggers.
I am doing because I need to re wriet a function for polgonal meshes that Is diffrent now and it is casue the wird explision when shape collide with face edges in bad cituation

I will re enable the triggers volume while doing that.
The palye and vehicle will come after I fix that high energy bug, which is very bad.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Trigger Volumes

Postby carli2 » Thu Aug 09, 2012 11:25 am

When will triggers be supported?
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Trigger Volumes

Postby Julio Jerez » Thu Aug 09, 2012 1:56 pm

after I do the checking in that fioex tteh hugh rotaional energy bug, I will enable the trigger volume.
that's about this weekend.

I will also complete the SSE path afet that.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Trigger Volumes

Postby carli2 » Tue Oct 23, 2012 5:47 am

I merged newton 3 now into my project because the ConvexCast is working correctly.

But after testing a while, I noticed, that NewtonCollisionIsTriggerVolume and NewtonCollisionSetAsTriggerVolume do not work correctly. This does not break everything, but at least it breaks some RPGs because you walk against a invisible wall.
Will you implement these two functions or will I have to workaround them?
carli2
 
Posts: 157
Joined: Thu Nov 10, 2011 1:53 pm

Re: Trigger Volumes

Postby Julio Jerez » Tue Oct 23, 2012 6:47 am

carli2 wrote:But after testing a while, I noticed, that NewtonCollisionIsTriggerVolume and NewtonCollisionSetAsTriggerVolume do not work correctly. This does not break everything, but at least it breaks some RPGs because you walk against a invisible wall.
Will you implement these two functions or will I have to workaround them?

This is correct, The trigger funtikonality will be impemnetetd using Kinematic bodies.
Bascailly a trigger is a kinematic body tha serve as a volumetic variable in the scene.

later this weekend shapes will have an option to make then invisible to collision. te will alowe for the to be part of a compound
but not collidable.

when this is done then a trigger will be a very lighwight object, teh will be simpel sensors tah will colling the close contact point, by not contacts.
for nwo you cna simple use Kineamtiocs bodies.
There is a demo that shows how to set up kinematic body as trigger.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Next

Return to General Discussion

Who is online

Users browsing this forum: No registered users and 2 guests

cron