Arkane Posted September 17, 2014 Share Posted September 17, 2014 Hi, I'm trying to resize the physics shape of a cylinder which is my player. I've tried a simple code : Entity* player; Model* playerModel; //Create the player player = Pivot::Create(); player->SetPhysicsMode(Entity::CharacterPhysics); // Set player physics player->SetPosition(Vec3(0, 1, 0)); player->SetMass(1); //Create player mesh playerModel = Model::Cylinder(64); playerModel->SetParent(player); playerModel->SetPosition(Vec3(0, 4, 0)); playerModel->SetScale(1, 2, 1); playerModel->SetColor(0.0, 1.0, 0.0); Shape* playerShape = Shape::Cylinder(0, 0, 0, 0, 0, 0, 2, 1, 1); playerModel->SetShape(playerShape); playerShape->Release(); What I'm doing wrong ? Thanks Quote Link to comment Share on other sites More sharing options...
Josh Posted September 17, 2014 Share Posted September 17, 2014 Just scale the entity and it will work. Or change your arguments in the Cylinder:Create function. 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 September 17, 2014 Share Posted September 17, 2014 Curious as to why you are creating a shape for the player model? Quote Link to comment Share on other sites More sharing options...
Arkane Posted September 17, 2014 Author Share Posted September 17, 2014 Thanks for your reply Josh. I just want to adjust the shape to because I saw that my model when it collides with a wall a small part of the cylinder go through wall. Like that : http://imgur.com/puev0s4 I think that's caused by not adjusted physics shape. Quote Link to comment Share on other sites More sharing options...
cassius Posted September 17, 2014 Share Posted September 17, 2014 //Create the player player = Pivot::Create(); player->SetPosition(0.0,1.309,0.5); player->SetMass(50); player->SetPhysicsMode(Entity::CharacterPhysics); jane.model->SetPosition(player->GetPosition()); Heres my similar code . replace jane.model with cylinder. 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...
cassius Posted September 18, 2014 Share Posted September 18, 2014 I have noticed in le2 and le 3.1 that things like guns and swords often partly protrude thru walls etc. but Making their physic shape too big may stop the character going thru doorways. 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...
Rick Posted September 18, 2014 Share Posted September 18, 2014 The character controller you have on the pivot gives you a cylinder shape for your character. If you have Nother shape and put them in the same location which would put them inside each other they might act badly. Multiple ppl have found the default character controller phyics limiting but otherwise you have to build your own which isn't easy to do well. Quote Link to comment Share on other sites More sharing options...
Arkane Posted September 18, 2014 Author Share Posted September 18, 2014 Thanks Cassius and Rick for your help. Is there a way to remove the default shape of the character controller and affect a new one with SetShape ? Quote Link to comment Share on other sites More sharing options...
Rick Posted September 18, 2014 Share Posted September 18, 2014 You can't remove the default character controller shape. You would simply not use it. However this means you have to control the physics of a shape that you make to act like the character controller, which isn't an easy task to get right and will most likely end in frustration . If your models are either clipping through you can either scale things down so they don't or just deal with it. Some will tell you that games like L4D and alike have models clipping and it's not that big of a deal. It's your call on the amount of effort you want vs the benefit you are getting from it. ie. It's not as simple as you're hoping. Quote Link to comment Share on other sites More sharing options...
Arkane Posted September 18, 2014 Author Share Posted September 18, 2014 So I will let this part away. I know many games have this issue that is considered as "not a big deal" for model clipping a little bit through "structures". I was just wondering if it was easily dealing with. But if it's not, no matter I will concentrate my effort on my third person camera collision (other post http://www.leadwerks.com/werkspace/topic/10702-third-person-camera-collision/). Thanks Rick for your help ! 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.