Remember me
You are here: HomeForumCyberix3D ForumExamples[Player Movement] Better Third Person Movement WIP
Welcome, Guest
Username: Password: Remember me

TOPIC: [Player Movement] Better Third Person Movement WIP

[Player Movement] Better Third Person Movement WIP 1 year 9 months ago #3117

www.gamemaker3d.com/player?pid=052615663428

I've been working on a more advanced Third Person movement system for a long time. And now you guys can use it in your projects!
How it works is you have an invisible cube target connected to the player for the camera to look at, and an invisible cube for the camera to attach to that rotates around the player.

The movement itself has the player rotate according where the camera is looking and what key you're inputting, and adds velocity to the player in that direction using impulse.

Issues with impulse based movement I've seen (for example in the monster NPC from the First Person Shooter template) is that you can't cap impulse based movement, so it just keeps accelerating. In this case, I found a way by adding an opposing impulse whenever the velocity hits a value I don't want it to go beyond.

I had to use impulse movement in order to have the player move in the camera's direction, as incrementing the player's xyz values don't work since they're locked to their axis instead of the player's local axis according to the camera direction. The alternate xAxis,yAxis,zAxis values don't work either as the camera isn't able to rotate locally with the player. Impulse movement is the only one where the local axis works with a fixated axis.

Sprinting works by setting the max velocity cap to a higher value, and returning it to default when the sprinting key is released.

Jumping works by determining if the player is on the ground or not, if it is then it adds an impulse upwards to the player. If the player's not on the ground, it can't jump cause you don't want the player infinitely jumping in the air (unless you want, it's open source why not?)

Things I want to add:
-Interpolation between the player rotation and camera rotation (it's too snappy currently)
-Normalizing diagonal sprint values (sprinting speed doubles diagonally)
-Player rotating towards diagonal movement (it doesn't rotate to diagonal movement)
-Smoother/Slower mouse sensitivity
-Max camera rotation (it inverts if you look up or down too much)
-Locking cursor without limiting mouse input
-Removing mouse border
-Aim mode (player rotates with camera)

Some of these probably won't be possible due to the limitations of the Cyberix engine but I'll try.

I also want to make a First Person equivalent to this.
Let me know what improvements I can make.

Cyberix3DPlayer_2suUTyzZeU.jpg

Cyberix3DPlayer_v4qY8iZzyW.jpg


old:
Cyberix3DPlayer_2lCcemJiz7.jpg

Cyberix3D_Px9J9F1Lv4.jpg
Last Edit: 1 year 9 months ago by Symbiotic Interactives.
The administrator has disabled public write access.
The following user(s) said Thank You: cyberix3d, ViraX

[Player Movement] Better Third Person Movement WIP 1 year 3 months ago #3146

Better Third Person 2 v1.0.0
www.gamemaker3d.com/player?pid=052615664039

Controls:
WASD - Movement
Mouse - Camera Orbit
IJKL - Camera Orbit (Set "Caminput" Var in "Cam_Position" Block to 2 in editor)

Features:
-Movement dependant on Camera Rotation
-Camera Orbit with Mouse Input

New Features
-Diagonal Movement (With the playermodel rotating appropriately)
-Non Physics based movement (Relies on the Character Code Block)
-Lower Mouse Sensitivity (Editable in Editor)

Bugs
-Camera Orbit is limited to the application border
-Camera Orbit won't work if you hide the cursor
-No Camera Rotation Clamp

The bugs currently can't be fixed since Cyberix would have to update the engine to support extended Mouse Input outside application border & with the cursor visibility off. I'm not sure if there's a way to clamp the Camera's rotation values either, if it's not possible then Cyberix might have to add a dedicated "Math.Clamp" Variable.

BTPM2_Screenshot1.jpg


BTPM2_Screenshot2.jpg


BTPM2_Screenshot3.jpg
Last Edit: 1 year 3 months ago by Symbiotic Interactives.
The administrator has disabled public write access.
The following user(s) said Thank You: cyberix3d

[Player Movement] Better Third Person Movement WIP 1 year 2 months ago #3148

v1.1.2
-Added smooth rotations.

I'm not sure if the Animate codeblock is buggy right now, but it seems that using variables for the end value doesn't work, so I found a work around. Instead, drop an Increment code block, set the Var, and in the Value type your EndValue minus your Var, and divided by a Smoothing Value.

Example:

math.div(x - y, z)

You should end up with a gradual transition between two variables. Unfortunately it is linear, but you can do all sorts of stuff now. For example you can have camera lag, have the gun in your fps game sway with the camera, all sorts of stuff.

For character rotations, it isn't there completely yet but it's good enough. Right now, one problem that occurs is that the player would rotate the whole opposite way around towards a rotation even if it's starting destination is near it. So if your direction is facing -45 degrees, and your goal is 180 degrees, it'll rotate the whole way to 180 degrees even if -180 degrees is closer. Right now I don't have a solution for this, but I understand the issue.

www.gamemaker3d.com/player?pid=052615664039
Last Edit: 1 year 2 months ago by Symbiotic Interactives.
The administrator has disabled public write access.
The following user(s) said Thank You: cyberix3d

[Player Movement] Better Third Person Movement WIP 1 year 2 months ago #3152

v1.1.3
-Added camera interpolation.

The camera will now smoothly follow and rotate the player. In the future I'll consider having two options for interpolation for the camera xyz and the camera rotation separately. Right now I wanna fix the player rotation.

www.gamemaker3d.com/player?pid=052615664039
Last Edit: 1 year 2 months ago by Symbiotic Interactives.
The administrator has disabled public write access.
Time to create page: 0.087 seconds