PoussinJoyeux Posted November 14, 2015 Share Posted November 14, 2015 Hi, I'm continuing my LW discovery. The new question I encounter is this one: -> If I have an animated model, the physic shape I put on it does not change with the animation (which seems normal from what I've seen). So what are my options if I want to avoid that other characters don't collide with it? From what I understand, I need to set a basic physic shape that will be big enough to cover all the area used during animation. Is there a better tuning option? Something which would be more accurate. I can see mentions of hitbox in the forum but I don't understand if it is the other solution? And if so, to generate it, is it done only by using the code lines like here (or do I need to do something else?): http://www.leadwerks.com/werkspace/blog/1/entry-1363-say-goodbye-to-hitboxes/ Thanks and sorry if my question is too easy! Quote Link to comment Share on other sites More sharing options...
cassius Posted November 14, 2015 Share Posted November 14, 2015 Create a pivot as a physics controller and attach the character to it. in c++ mycharacter.pivot = Pivot::Create(); mycharacter.pivot->SetPosition(-44, 2.9, 22.0); mycharacter.pivot->SetMass(50); mycharacter.pivot->SetPhysicsMode(Entity::CharacterPhysics); mycharacter.model->SetPosition(mycharacter.pivot->GetPosition()); Don't worry about the size of the pivot. EDIT:Or have I misssunderstood your question? 1 Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
PoussinJoyeux Posted November 15, 2015 Author Share Posted November 15, 2015 Hi cassius, First, thanks for your answer! I tried your code but my FPS player still go through the sculpture (even when sculpture is not moving). Here are some abstracts of my code: //Sculpture Model* sculptureMesh; Entity* sculpture; ... // Init Sculpture sculptureMesh = Model::Load("Models/BlenderImport/animation.mdl"); sculpture = Pivot::Create(); sculpture->SetPosition(10, 10, 10); sculpture->SetMass(10); sculpture->SetPhysicsMode(Entity::CharacterPhysics); sculptureMesh->SetPosition(sculpture->GetPosition()); sculptureMesh->SetParent(sculpture); So yes, maybe I was not clear So what I want is that my FPS player (or other characters) collides with my "sculpture" mesh and does not go through it. And this "sculpture" is not a simple box/ball and have animation. So if create a convex physic shape, it will only cover the first frame of animation and the only way I've found until now is to set a big physic sphere all around the sculpture but it is not accurate enough and my FPS player is like blocked by invisible walls when he approaches from the sculpture. Quote Link to comment Share on other sites More sharing options...
cassius Posted November 15, 2015 Share Posted November 15, 2015 I don't think animation has anything to do with collision. All collidable objects in the game need a physics controller set either in code or in the editor scene panel. Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
PoussinJoyeux Posted November 15, 2015 Author Share Posted November 15, 2015 Yes I agree with you but my point is: how can I be sure that my object will correctly manage collisions in all states of its animation? Imagine a guy who keeps his arms close to its body and then raises them at the end of the animation. So if I set the physic shape to convex decomposition on the first frame then when he raises his arms, his hands will be out of the physic shape (because the shape does not follow animation) and so anybody will go through his hands and will not collide. Am I more clear? Quote Link to comment Share on other sites More sharing options...
cassius Posted November 15, 2015 Share Posted November 15, 2015 In my game swords and arms sometimes go through walls. I think that has to be accepted.I have seen it in several games. 1 Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
PoussinJoyeux Posted November 16, 2015 Author Share Posted November 16, 2015 Ok I will have to admit that too then... Thanks cassius for your answers on this subject. Quote 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.