SCRIPTING THE VECTOR MOTIONS AND LANE MOVEMENTS

in Game Development2 years ago (edited)

boy_scene_banner.jpg

Hello friends, hope the weekend was good... First of all, before I talk about scripting, I had to do some tweaking to my model again. Yeah, I know, It's like the 4th time now but I guess I wasn't just satisfied with the look.

st_1a.jpg

I worked on the hair, previously the character had some dreadlocks but then I realized that looking at the character from behind he looked like a girl lol... Although I would still model a female character for this game in the future. I just want to properly define this particular character first.

st_2.jpg

I opted for a simple fade afro hairstyle... I just had to subdivide the mesh a lil bit and extrude the top faces. It looked more simplistic and I'm at least happy that this new hairstyle has fewer polygons.

st_6.jpg

Now the boy is looking peng 😎

Character Controller

st_4.jpg

In order to get this character moving, I had to add a character controller component, it is like a capsule that surrounds the character, as the name implies, this component works together with the vector motions to control the movement as you press the key strokes.

VECTOR MOTIONS
The next step was to create a player motor script, this script would be attached to the character(character controller) within this script would be the vector components and variables for the forward and side motions.

st_3a.jpg

Within this player motor script, I used the vector 3 constructor to calculate values in the X,Y and Z axis.

st_6a.jpg

Z-axis MOVEMENTS TEST RUN
There were two problems with this test run. First was the slight lag between the running motion and the ground. it looks like it's sliding. Secondly, I also needed to write a camera follow script to follow the character.

runninnnnn.gif

Camera follow script test
After creating the camera follow script, I solved the lag by increasing the speed of the Vector3 component.

camera_follow2.gif

X-axis Lane Movements
I achieved this Lane movement by using a mathf-clamp function to cap the x-axis on -1 to +1 but the motion still needs some finesse, when the character is moving to the left or right he's not supposed to slide across.

lane_movements.gif

I might be able to solve this by creating a buffer animation at the keypress(left or right) so that when I press the left or right key, the character would slightly tilt to the direction instead of maintaining its stride.

What Next
My next steps would be to smoothen that lane movement, I am currently experimenting with a buffer animation as a solution.

I also want to work on the skybox. I must confess I don't like the low poly clouds design, I think I would create a flat 2d plane with some cloud illustration attached to it, which would be following the scene.

Then I should also get to modeling the obstacles on the paths and also other street tiles and environment models.

Join me next time as I tackle these issues, thanks for your time :)

You can check out my previous episode here:

ANIMATION AND RIGGING - SOLVING MY 3D CHARACTER GLITCH

hive_banner_2.gif

Sort:  

Yay! 🤗
Your content has been boosted with Ecency Points, by @abmakko.
Use Ecency daily to boost your growth on platform!

Support Ecency
Vote for new Proposal
Delegate HP and earn more

thank you for taking part in PYPT ... you now have the badge. You should see it on your peakd profile

thanks xD