Jump to content

LE3 C++ create physic object Dynamically


tjheldna
 Share

Recommended Posts

Hi Josh,

 

Getting a crash on PhysicsSetPosition when it hits the ground in c++. I'm not sure if I am creating the object properly in code or it's a bug.

 

- C++

- The Model is loaded dynamically in the game.

- Add a shape to the model

- Try to apply some velocity to it.

- When PhysicsSetPosition is called I get a crash.

- Variable projectileDirection can be any value.

 

model = Model::Load("Models/Inventory/Projectile/Projectile.mdl");

 

Shape* shape = Shape::Box();

 

entity->SetShape(shape);

shape->Release();

entity->SetCollisionType(Collision::Prop);

 

 

entity->SetMass(2);

 

 

Game loop

 

entity->PhysicsSetPosition(projectileDirection.x, projectileDirection.y, projectileDirection.z, 2);

 

 

trindieprod.png?dl=0spacer.png?dl=0steam-icon.png?dl=0twitter-icon.png?dl=0spacer.png?dl=0
Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...