Jump to content

Can Controller Entities Be Repositions?


gamecreator
 Share

Recommended Posts

I'm trying to code a 2D platformer and am using a controller. Everything is working fine so far but when I tried to keep the character on the 2D plane, the controller didn't react as I expected it to (it got slow and more jittery). Here's the code.

 

UpdateController(player,270.0,move,0.0,jump,50);
pos=EntityPosition(player,1);
PositionEntity(player,Vec3(pos.X,pos.Y,0));

 

I take it PositionEntity and UpdateController don't get along. But maybe I'm just doing something wrong.

 

(These lines are just before UpdateFramework() and RenderFramework(), by the way.)

 

Thanks.

 

Edit: I tried putting it between Update and Render and also after both but neither worked.

Link to comment
Share on other sites

From what I remember, calling PositionEntity while having forces also working on bodies (which the controller is and UpdateController() is doing) don't play well.

 

One way to do what you want could be to not allow movement of the controller in any direction but 2. Pick either forward/back or strafe left/right but one or the other and then don't allow rotation at all. Then just make sure you align everything correctly before the level starts and the player has no options but to stay in line.

Link to comment
Share on other sites

Thanks guys. Aily, I've thought of doing what you mention and wasn't sure if it was necessary but it seems it is. Rick, surprisingly, I'm only having the controller go strictly left and right and the plane it's on is level. Even if it goes up and down it doesn't tilt forward or back, if that makes sense. And yet, I've had the controller fall off the edge on the back somehow. Not a problem. I'll just implement Ailly's method. Was just wondering if what I suspected was the case. Thanks again.

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