gamecreator Posted July 31, 2011 Share Posted July 31, 2011 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. Quote Link to comment Share on other sites More sharing options...
Aily Posted July 31, 2011 Share Posted July 31, 2011 I was fighting with it myself. And cant handle controller by z=0. Maybe two physics planes can help you like back and front limits. Quote "Better" is big enemy of "good" Link to comment Share on other sites More sharing options...
Rick Posted July 31, 2011 Share Posted July 31, 2011 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. Quote Link to comment Share on other sites More sharing options...
gamecreator Posted July 31, 2011 Author Share Posted July 31, 2011 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. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted July 31, 2011 Share Posted July 31, 2011 You could use simply a physic constraint on the axe where you don't want movement Quote Stop toying and make games 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.