Jump to content

Can't stop Moonwalking!


Angelwolf
 Share

Recommended Posts

Okay, so I'm trying to have my 3rd person model (at a side on, 2d style view) look left when walking left, and to look right when walking right.

 

So far, walking right is not a problem. The model animates and walks, facing the correct direction.

When walking left, however, the model 'moonwalks'. He'll move backwards, but will face forwards.

 

local movex=0
local movez=0
self.input[0]=0
self.input[1]=0

if window:KeyDown(Key.D) then self.animationmanager:SetAnimationSequence("Run",self.animspeedrun,300) self.input[1]=self.input[1]+1 self.animationmanager:SetAnimationSequence("Idle",self.animspeedrun,300) end
if window:KeyDown(Key.A) then self.entity:SetRotation(0,-90,0) self.animationmanager:SetAnimationSequence("Run",self.animspeedrun,300) self.input[1]=self.input[1]-1 self.animationmanager:SetAnimationSequence("Idle",self.animspeedrun,300) end
if window:KeyDown(Key.S) then self.entity:SetRotation(0,-180,0) end
if window:KeyDown(Key.W) then self.entity:SetRotation(0,365,0) end

local playerMovement = Vec3(0)
playerMovement.x = self.input[0] * self.moveSpeed
playerMovement.z = self.input[1] * self.moveSpeed

 

dungeoncreeper.gif

 

Any ideas?

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