TheConceptBoy Posted June 4, 2019 Share Posted June 4, 2019 Greetings everyone. I'm experimenting with C++ at the moment and it seems that the Box model I create via code is falling through the floor half way, I've even tried to attach a shape to it, however that does not seem to affect it in any way. Someone said that if a 3D model is falling through the floor, it needs to have it's x0, y0 and z0 to be at the feet of the chatacter. This is a simple box made in code and it feels as if the collisions with the world are being calculated for a single point, rather than a shape. Model* player_sphere = Model::Box(); player_sphere->SetPhysicsMode(Entity::CharacterPhysics); player_sphere->SetMass(1); player_sphere->SetPosition(0, 10, 0); Shape * pl_shape = Shape::Box(0,0,0, 0,0,0, 20,20,20); player_sphere->SetShape(pl_shape); Camera* camera = Camera::Create(player_sphere); camera->Move(0.4, 2.4, -1); I just want to see if tis is normal behavior. All the ramp, plane and terrain collisions seem to be working ok. I can offset the camera. I just have a feeling that you would normally see the shape not sink half way into the ground as if the collisions are being calculated for the single center point as opposed to a 3D shape. EDIT1: Now i see that this question has been asked at least once already. Thread 1 and Thread 2 These people have been dealing with the 3D models. For now I just want to find out whether the objects, a simple box, created via C++ API commands, with a character controller for it's physics collision is supposed to be sunk half way in the first place? It seems so weird because, if I set the shape to a cylinder or a sphere, I can see the sides of the spheres colliding with the walls and preventing movement. Why does this also not affect the bottom of the sphere? 1 Quote Link to comment Share on other sites More sharing options...
gamecreator Posted June 4, 2019 Share Posted June 4, 2019 For this reason, it's best to use a pivot as a character controller and parent anything you'd like to it, like so: Model* player_sphere = Model::Box(); player_sphere->SetPosition(0, 0.5, 0); Entity* controller = Pivot::Create(); controller->SetMass(1); controller->SetPhysicsMode(Entity::CharacterPhysics); player_sphere->SetParent(controller, true); Also, it may help you to turn on physics debugging to see what's going on. camera->SetDebugPhysicsMode(true); Great job on all the detail you provided, by the way. It inspired me to jump into Visual Studio to research this. Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 4, 2019 Author Share Posted June 4, 2019 3 minutes ago, gamecreator said: For this reason, it's best to use a pivot as a character controller and parent anything you'd like to it, like so: Model* player_sphere = Model::Box(); player_sphere->SetPosition(0, 0.5, 0); Entity* controller = Pivot::Create(); controller->SetMass(1); controller->SetPhysicsMode(Entity::CharacterPhysics); player_sphere->SetParent(controller, true); So that's a yes then? This is normal behavior for the character controller? The physics are calculated for a point in space instead of some sort of a volume objects? I take it the shape is meant for rigid bodies only then, not character controllers? Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 4, 2019 Author Share Posted June 4, 2019 Oooh I see, it's a cylinder! that's the character controller collision shape. I see Quote Link to comment Share on other sites More sharing options...
Abstergo Posted June 4, 2019 Share Posted June 4, 2019 Quote >player_sphere >Model::Box(); 2 Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 4, 2019 Author Share Posted June 4, 2019 Haha. I was experimenting with various shapes after a couple of hours of hair pulling. I got fed up with changing the variable names here and 20 other places. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted June 4, 2019 Share Posted June 4, 2019 lol that's a hell of a first post, Abstergo. Welcome to the forums! Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 4, 2019 Author Share Posted June 4, 2019 Did you @Abstergo By any chance google this question and this is what popped up? Because I literally just posted this an hour ago. haha. Quote Link to comment Share on other sites More sharing options...
Abstergo Posted June 4, 2019 Share Posted June 4, 2019 No, I just came in from the Discord to see if I could help out. Quote Link to comment Share on other sites More sharing options...
Josh Posted June 4, 2019 Share Posted June 4, 2019 The entity pivot will be at the very bottom of the physics shape, since character models are usually created with the origin at the feet. 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...
TheConceptBoy Posted June 4, 2019 Author Share Posted June 4, 2019 Thanks, Josh. Yeah I got that figured out lat night. The Physics Debug Mode helped me visualize it. So is the Cylinder Width hard coded into the engine? Someone said it's size is used for the navmesh calculation? Quote Link to comment Share on other sites More sharing options...
gamecreator Posted June 4, 2019 Share Posted June 4, 2019 Yes, the character controller is fixed dimensions. We've had discussions in the past trying to improve the navigation system but it sounds like it's a lot of work. Still, I hope Josh considers expanding its possibilities for Turbo. Quote Link to comment Share on other sites More sharing options...
TheConceptBoy Posted June 4, 2019 Author Share Posted June 4, 2019 I see, so generally speaking your player character, be it first person or 3rd person should be scaled to that cylinder then? What about vehicles? Things that are much bigger than the character that occupy them, Use rigid bodies in those cases? 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.