Jump to content

model position


cassius
 Share

Recommended Posts

When I load in a character by code it becomes half buried in the ground

Here is my code

 

badguy->SetPosition(54.06,2.077,-1.37);

badguy->SetMass(60);

badguy->SetPhysicsMode(Entity::CharacterPhysics);

badguy->Move(0,0.5,0);

 

Move makes no difference.

Anyone help? Thanks

 

 

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

With mass set to 0 the model is correctly placed.But that's no good to me.

 

Concerning the texture. If I place a instance of the model in the editor then the code loaded version does have texture on. If I remove the model in the editor the loaded model has no texture.

 

 

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

Did you place the texture on the model in the model editor and then save it or are you placing the texture on the model in the world editor? If you place the material on the model in the world editor, then if you load manually through code you'd have to load material manually and put it on via code also because that's what's happening behind the scene in the world editor. The reason you see it work normal if you already have it loaded is because of instancing. Loading the same model will have the same material applied.

 

About the physics it sounds like your model is offset to the actual character controller. Turn on physics to see the where the character controller is in relation to the model.

Link to comment
Share on other sites

It seems to be a physic and mass problem.

Are you sure the mass is not to put on characterController object only ?

The mesh character don't need one as it only follows the characterController ?

 

For now i only place character on the map, not by code so perhaps i'm wrong.

Stop toying and make games

Link to comment
Share on other sites

When I load in a character by code it becomes half buried in the ground

 

With mass set to 0 the model is correctly placed.But that's no good to me.

 

 

So whilst it seems a little rude to ask - are the physics for the ground are accurate?

LE Version: 2.50 (Eventually)

Link to comment
Share on other sites

Zio: ok but can prefabs be animated?

Of course, it is like common models but you can integrate more models and camera and whatever else you need into them. I can send you my project source if you like, to see how I'm managing it, I created a component based system very similar to another engine (and to Aggror's system may be) which should help to spread features over different small chunks (I have only two components by now "player input" and "character animation" and should be easy to follow).

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Link to comment
Share on other sites

i am not sure but since you said that it works when it has no mass,

 

have you tried this order of lines?

badguy->SetPosition(54.06,2.077,-1.37);
badguy->Move(0,0.5,0);
badguy->SetPhysicsMode(Entity::CharacterPhysics);
badguy->SetMass(60);

 

So first the position is set and then it gets physics so it can't fell down or something like that before the position is set.

Link to comment
Share on other sites

Thanks Zio. It looks like I forgot about the need for character controller. I should know better after two years with le2. Maybe no CreateController in le3 confused me. I will try the prefab route tonight. Thanks to all.

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

This seems to work ok

 

bg_control = Pivot::Create();

bg_control->SetMass(30);

bg_control->SetPhysicsMode(Entity::CharacterPhysics);

bg_control->SetPosition(54.06,2.077,-1.37);

badguy->SetParent(bg_control,false);

badguy->Move(0,1.6,0);

 

Now I need to find the le3 equivalent of UpdateController

 

 

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

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...