Jump to content
2ima

C++ SetInput incorrect work

Recommended Posts

using reference i found how to make entity movement and got such:

move = window->KeyDown(Key::W) - window->KeyDown(Key::S);
strafe = window->KeyDown(Key:) - window->KeyDown(Key::A);
//Making sure that movements is normalized so that moving forward at the same time as strafing doesn't move your character faster
normalizedmovement.z = move;
normalizedmovement.x = strafe;
normalizedmovement = normalizedmovement.Normalize() * movespeed;

//Adjust and set the camera rotation
playerrotation.x += mousespeed.y*sensitivity / 10.0;
playerrotation.y += mousespeed.x*sensitivity / 10.0;
entity->SetInput(playerrotation.y, normalizedmovement.z, normalizedmovement.x, jump, crouched, maxaccel);

 

and entity is not moving! maybe somebody more experted than me can see my mistake?

Checked out FPSplayer.lua, looks like just myne. Kinda magic) Maybe smb has more sufficient metod of entity movement? Thanks beforehand!)

Share this post


Link to post

Hard to say with the code provided. Does the 'entity' have a mass greater than 0? Does the 'entity' have its Physics Mode set to Character Physics? Have you tried printing out the values of 'normalizedmovement' X & Z values? What's the 'maxaccel' variable set to?

Share this post


Link to post

entity mass is 50, Physics Mode and Character Physics is set properly, 'normalizedmovement' X & Z values is set and working... maxaccel is maximal acceleration to disable enitity's element race.

The thing is in what when I try to use constant values instead all of those still nothing

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

×
×
  • Create New...