Rick Posted October 20, 2015 Share Posted October 20, 2015 What is Move() doing behind the scenes? I was using it to move left/right but now I need to rotate the player but still move on the x plane only so can't use Move() as it's relative and not what I need. So I figured I'd use SetPosition() and just add to the x position but it moves super fast now where with Move() it was smooth. So I assume Move() was doing something to smooth this movement that I now need to do. if self.window:KeyDown(Key.A) then x = ((1 * self.moveSpeed) * Time:GetSpeed()) end if self.window:KeyDown(Key.D) then x = ((-1 * self.moveSpeed) * Time:GetSpeed()) end -- move the player --self.entity:Move(x, 0, 0) local pos = self.entity:GetPosition(true) pos.x = pos.x + x self.entity:SetPosition(pos) Quote Link to comment Share on other sites More sharing options...
Einlander Posted October 20, 2015 Share Posted October 20, 2015 What happens when you set the fourth move parameter to true? Quote Link to comment Share on other sites More sharing options...
YouGroove Posted October 20, 2015 Share Posted October 20, 2015 Are you using that code in UpdatePhysics ? If you use SetPosition() in UpdateWorld it will be smooth. If it is too fast you can decrease your self.moveSpeed parameter. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted October 20, 2015 Author Share Posted October 20, 2015 Well, the idea I'm looking for is with that speed value it works great for Move() but not for SetPosition() but wondering why exactly. The above code is called in the same spot. @Einlander Nothing changes if I do that. It's still super fast movement. To the point where it looks like he's teleporting but you can faintly see trails so you know he was in another spots and is just moving really fast. Quote Link to comment Share on other sites More sharing options...
Dralel Posted December 31, 2015 Share Posted December 31, 2015 I have the same rotate problem, except my player either does not rotate at all or "strafes" to the side instead of rotating on the spot. My code is in the UpdatePhysics loop. Quote 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.