Jump to content

[Solved] Controller moving randomly


Roland
 Share

Recommended Posts

http://www.youtube.com/watch?v=h_w7fwkUI8Q



My character is moved randomly as seen in the video.
There is not much special about the code

I load my scene which contains the door, firepit and terrain using LoadScene
LoadScene( "abstract::testlevel.sbx" );



I load my character model using LoadModel

TModel _model = LoadModel( "abstract::celly.gmf" ) ;

I create a contoller
[code]
// _height is 1.7
// _modelPos is position of the character loaded
// CollisionType::Prop is 1
TController _controller = CreateController( _height );
PositionEntity(_controller, modelPos );
SetBodyMass(_controller, 1);
SetBodyGravityMode(_controller, 1 );
EntityType(_controller, CollisionType::Prop);



In my main loop i call update on controller
Note.. I do not force any movement at all in the UpdateController
I do not have any code that could move the character or controller at all.

// _mode is the character model loaded
UpdateController( _controller );

RotateEntity( _model, EntityRotation(_controller ) );
PositionEntity( _model, EntityPosition(_controller) );




Cant find out why the model is moving around by it self.
Have done this before in other test snippets without problems
but now this happens. Any hints?

I have done this before without any problems. It was when rewriting my code-lib which I lost (see my blog) this occurred. So I'm doing something weird dumb this time. Just cant find out what. I commented out all code that could move the character in any possible way, bit still she moves.

Edited by Roland

Roland Strålberg
Website: https://rstralberg.com

Link to comment
Share on other sites

..can you see controller moving with debug physics enabled ??.. also, have you try to swap positions of

UpdateController( _controller );

 

and

 

RotateEntity( _model, EntityRotation(_controller ) );

PositionEntity( _model, EntityPosition(_controller) );

 

in your main loop ?Is it controller parented to anything ?

 

Link to comment
Share on other sites

Random movement occurs when 2 physics bodies are parented, and they are colliding with eachother. The solution is the make the 2 bodies of different collisiontype, for example 6 and 7. And course to make sure that type 6 and 7 are not setup with EntityCollisions to collide with eachother.

Ryzen 9 RX 6800M ■ 16GB XF8 Windows 11 ■
Ultra ■ LE 2.53DWS 5.6  Reaper ■ C/C++ C# ■ Fortran 2008 ■ Story ■
■ Homepage: https://canardia.com ■

Link to comment
Share on other sites

Random movement occurs when 2 physics bodies are parented, and they are colliding with eachother. The solution is the make the 2 bodies of different collisiontype, for example 6 and 7.

Yes Meta... That was the problem.

Naught.. you were also into the solution (Is it controller parented to anything ? )..

Thanks smile.png

Roland Strålberg
Website: https://rstralberg.com

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