Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

3 Dimensional Chat / How can you walk in 2 directions at the same time with Move3DPhysicsCharacterController?

Author
Message
CoreGrid
User Offline
Joined: 16th Feb 2017
Location:
Posted: 17th Jun 2017 22:51

// Character Controller - WASD
agk::Move3DPhysicsCharacterController(playerCharacterController, 0, 0); // Stops Character Controller from the previous calculation basically unpressing the walk key

// direction - 0 = stop, 1 = forward, 2 = backward, 3 = strafe left, 4 = strafe right;
if (agk::GetRawKeyState(87)) { agk::Move3DPhysicsCharacterController(playerCharacterController, 1, cam_speed * 25); } // w
if (agk::GetRawKeyState(83)) { agk::Move3DPhysicsCharacterController(playerCharacterController, 2, cam_speed * 25); } // a

// Left and right
if (agk::GetRawKeyState(65)) { agk::Move3DPhysicsCharacterController(playerCharacterController, 3, cam_speed * 25); } // a
if (agk::GetRawKeyState(68)) { agk::Move3DPhysicsCharacterController(playerCharacterController, 4, cam_speed * 25); } // d


This is my code for tier 2 tier 1 is pretty much the same just differently written. What im trying to achieve is to walk in 2 directions at the same time, for example forward and to the left.
The way the code works is that the most recent line get executed so if i hold w and a i will walk to the left since the walk forward line gets overwritten with walk to the left.
Is there some way to execute 2 lines at once and walk left and forward at the same time?
Golelorn
User Offline
Joined: 20th Nov 2016
Location:
Posted: 29th Jun 2017 22:29 Edited at: 29th Jun 2017 22:30
Yes.

I do not know tier 2. But tier 1 would be something like:

if forward keypressed and left keypressed then move characterobject zaxis+xaxis

Login to post a reply

Server time is: 2017-09-19 16:11:43
Your offset time is: 2017-09-19 16:11:43