Jump to content

Recommended Posts

Posted

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

Posted

It made no difference

Also the character has no texture on it although it does when placed in the editor.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted

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

Posted

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.

Posted

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

Posted

I would rather make a pivot that is the character controller and then load the model. Since the characterPhysics automatically create a cylinder and I don't want it to mess with the mesh of the character. Then I parent this model to the character controller.

Posted

I think it would be a lot better if you setup your model in the editor, then save it as prefab and finally load it through code (Prefab::Load). It is like I'm doing now and it seems fine, besides the fact that using a prefab is much easier since it can save lot of code.

?? FRANCESCO CROCETTI ??

http://skaredcreations.com

Posted

Zio: ok but can prefabs be animated?

 

Thanks to all for replies.

I will check them all out.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

Posted
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)

Posted

Why do we have to use such "Turn around" one time again ?

LE 3 sould do the job without going Prefab.

Well let's give even more time to LE3 to maturate.

Stop toying and make games

Posted

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

Posted

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.

Posted

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

Posted

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

Posted

Yes setinput has the same parameters.I will try the prefab thing with my next character.

amd quad core 4 ghz / geforce 660 ti 2gb / win 10

Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++

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.

×
×
  • Create New...