Jump to content

Recommended Posts

Posted

When using SetCollisionResponse() the third value seems to reflect the type of response. From what I gather 0=none and 1=collide with physical reaction

 

Question is: are there any other types that can be set? For example, is there a "collide with no reaction" response, etc?

--"There is no spoon"

Posted

If the response type is Collision::Trigger it does what it sounds like. No physical collision, but the script functions and callbacks are called.

 

 

Posted

Yeah, understood. I was just wondering if there was a list available in the event I needed to set up some special case. But yes, it looks like your predefined types cover the majority of cases.

 

Thanks.

--"There is no spoon"

Posted

The list is hidden inside the user guide:

 

Collision type

 

This is the object's collision type. Collision types control what kinds of objects collide with one another. The following collisions will be recognized:

  • Character : Character
  • Character : Prop
  • Character : Scene
  • Character : Trigger (detection only, no physical reaction)
  • Prop : Prop
  • Prop : Scene
  • Prop : Debris
  • Debris : Scene

http://www.leadwerks.com/werkspace/page/documentation/_/user-guide/scene-browser-r675

Posted
When using SetCollisionResponse() the third value seems to reflect the type of response. From what I gather 0=none and 1=collide with physical reaction

 

That would be good to have controll over, however what you need to do is, anything that needs no physic collision response is in Set it to trigger and in the oncollision have a switch statement to work out what initiated the collision. I use GetUserData() to store an object and it's type.

 

Something like this....

 

void TriggerCollision(Entity *entity0, Entity *entity1, float *position, float *normal, float *speed)
{
BaseObject* object = (BaseObject*)entity0->GetUserData();
if(object->GetBaseType() == kObjectTrigger)
{
Trigger *trigger = static_cast<Trigger*>(object);
if((trigger) && !trigger->IsDisabled())
{
//Find what the hit target is
BaseObject* hitObject = (BaseObject*)entity1->GetUserData();
if(hitObject)
{
switch(trigger->GetType())
{

 case kObjectDeathZoneTrigger:
 {
 trigger->Activate(trigger, hitObject);
 break;
 }


etc.....

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
  • 1 month later...
Posted

I'd like to see documentation on the collision types. I just noticed that there is a new type called "Projectile", where does that come from? What is the behavior of each type? I know what some of them do as I figured it out, but I don't know why and if it's even supposed to do that. Please give us more information.

Posted

Some layers would could detect collision only and not physically collide

Others layer could not detect collision against other layers so not collide.

Would be usefull for many stuff, already asked on suggestion.

 

I'd like to see documentation on the collision types. I just noticed that there is a new type called "Projectile", where does that come from? What is the behavior of each type? I know what some of them do as I figured it out, but I don't know why and if it's even supposed to do that. Please give us more information.

 

Like physics and physics functions you'll have to try and experiment yourself to find what is working.

Like for Ball joint physics : a real nightmare when not enought examples or more precise doc saying last argument must be null if you use only one entity of type prop for example or it don't work. After many tries and experiments you finish to find trying hazardously not last parameter in your case you need laugh.png

Stop toying and make games

  • 2 weeks later...
Posted (edited)

I'd also like to see some documentation on the collision stuff. All this sneaking around, trying to piece together a picture of how things work by looking at code snippets, reading various forum posts, searching around with Google... It could all be avoided if there was some sort of documentation about how the engine works. I see someone did a series of tutorials in Youtube for Leadwerks (sadly no episode for collision other than the raycasting basics), the engine would be practically unusable without them.

 

I wish there was a way to see a list of every available function in LE 3.1 and all the parameters, return values, and their types. (Well, I guess the Command Reference works for that, and it has been the best source of information so far).

Edited by Toaster
  • Upvote 1
Posted

Yes, it's just a little convoluted:

PhysicsDriver::GetCurrent()->virtual void SetCollisionResponse(const int collisiontype0, const int collisiontype1, const int response);

 

That should really be simplified.

 

 

Posted

I assume that's:

 

PhysicsDriver::GetCurrent()->SetCollisionResponse()? That's not convoluted at all. Get the pointer to the current physics driver and call the function.

Posted

Calling a collision set function on the physics driver seems very logical to me. Plus you already have that setup so no extra work. You have enough to do :)

Posted

I am adding a new command right now:

Collision::SetResponse(type1,type2,response)

 

It will be in the next beta build on Steam.

 

Hmmmm....apparently the command above is already added!

  • Upvote 3

My job is to make tools you love, with the features you want, and performance you can't live without.

  • 1 month later...
Posted

I am adding a new command right now:

Collision::SetResponse(type1,type2,response)

 

It will be in the next beta build on Steam.

 

Hmmmm....apparently the command above is already added!

 

Has anyone been able to get this to work in lua? It appears that you can set the collision type to any integer but it appears the SetResponse() is looking for a pre-defined collision class...

Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590

LE / 3DWS / BMX / Hexagon

macklebee's channel

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...