cassius Posted June 18, 2013 Share Posted June 18, 2013 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 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 June 18, 2013 Share Posted June 18, 2013 What happens if you set position after you set physics mode? Quote Link to comment Share on other sites More sharing options...
cassius Posted June 18, 2013 Author Share Posted June 18, 2013 It made no difference Also the character has no texture on it although it does when placed in the editor. 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 June 18, 2013 Author Share Posted June 18, 2013 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. 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 June 18, 2013 Share Posted June 18, 2013 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. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted June 18, 2013 Share Posted June 18, 2013 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. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
AggrorJorn Posted June 18, 2013 Share Posted June 18, 2013 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. Quote Link to comment Share on other sites More sharing options...
ZioRed Posted June 18, 2013 Share Posted June 18, 2013 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. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
cassius Posted June 18, 2013 Author Share Posted June 18, 2013 Zio: ok but can prefabs be animated? Thanks to all for replies. I will check them all out. 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...
AggrorJorn Posted June 18, 2013 Share Posted June 18, 2013 Yes they can. Prefabs are entities when they are loaded. Quote Link to comment Share on other sites More sharing options...
Mumbles Posted June 18, 2013 Share Posted June 18, 2013 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? Quote LE Version: 2.50 (Eventually) Link to comment Share on other sites More sharing options...
YouGroove Posted June 18, 2013 Share Posted June 18, 2013 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. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
ZioRed Posted June 18, 2013 Share Posted June 18, 2013 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). Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
beo6 Posted June 18, 2013 Share Posted June 18, 2013 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. Quote Link to comment Share on other sites More sharing options...
cassius Posted June 18, 2013 Author Share Posted June 18, 2013 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. 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 June 18, 2013 Author Share Posted June 18, 2013 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 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...
ZioRed Posted June 18, 2013 Share Posted June 18, 2013 Now I need to find the le3 equivalent of UpdateController I don't remember what UpdateController did on LE2, may be SetInput Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
cassius Posted June 18, 2013 Author Share Posted June 18, 2013 Yes setinput has the same parameters.I will try the prefab thing with my next character. 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...
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.