Michael_J Posted March 22, 2014 Share Posted March 22, 2014 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? Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
Admin Posted March 22, 2014 Share Posted March 22, 2014 If the response type is Collision::Trigger it does what it sounds like. No physical collision, but the script functions and callbacks are called. Quote Link to comment Share on other sites More sharing options...
Michael_J Posted March 22, 2014 Author Share Posted March 22, 2014 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. Quote --"There is no spoon" Link to comment Share on other sites More sharing options...
bandrewk Posted March 22, 2014 Share Posted March 22, 2014 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 Quote Link to comment Share on other sites More sharing options...
tjheldna Posted March 22, 2014 Share Posted March 22, 2014 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..... Quote Link to comment Share on other sites More sharing options...
bandrewk Posted April 26, 2014 Share Posted April 26, 2014 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. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted April 26, 2014 Share Posted April 26, 2014 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 Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Toaster Posted May 11, 2014 Share Posted May 11, 2014 (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 May 11, 2014 by Toaster 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted May 11, 2014 Share Posted May 11, 2014 This is something I've been meaning to write: http://www.leadwerks.com/werkspace/page/documentation/_/command-reference/collision-r778 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gamecreator Posted May 12, 2014 Share Posted May 12, 2014 That makes things a lot clearer. But I wonder: can we use the system we had in LE2 where we could just use our own numbers and assign collisions arbitrarily? Quote Link to comment Share on other sites More sharing options...
Admin Posted May 12, 2014 Share Posted May 12, 2014 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. Quote Link to comment Share on other sites More sharing options...
Rick Posted May 12, 2014 Share Posted May 12, 2014 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. Quote Link to comment Share on other sites More sharing options...
Josh Posted May 12, 2014 Share Posted May 12, 2014 Collision::SetResponse() would be more elegant and intuitive. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Rick Posted May 12, 2014 Share Posted May 12, 2014 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 Quote Link to comment Share on other sites More sharing options...
Toaster Posted May 13, 2014 Share Posted May 13, 2014 I got the collision working by fooling around a bit. Removed my question from this post until I get stuck somewhere else later. Quote Link to comment Share on other sites More sharing options...
Haydenmango Posted May 20, 2014 Share Posted May 20, 2014 Sorry, old post but... Does PhysicsDriver::GetCurrent()->virtual void SetCollisionResponse(const int collisiontype0, const int collisiontype1, const int response); work in Lua? I tried converting the code but it isn't working for me. This would be super useful for a game I am working on at the moment. Quote Check out my game Rogue Snowboarding- https://haydenmango.itch.io/roguesnowboarding Link to comment Share on other sites More sharing options...
Josh Posted May 22, 2014 Share Posted May 22, 2014 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! 3 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
gamecreator Posted May 22, 2014 Share Posted May 22, 2014 Yay!! Make it official by adding it to the documentation too and we're set. Quote Link to comment Share on other sites More sharing options...
macklebee Posted June 28, 2014 Share Posted June 28, 2014 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... Quote Win7 64bit / Intel i7-2600 CPU @ 3.9 GHz / 16 GB DDR3 / NVIDIA GeForce GTX 590 LE / 3DWS / BMX / Hexagon macklebee's channel Link to comment Share on other sites More sharing options...
Recommended Posts
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.