Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Quick Question!

A topic by Hi-Tech Developerz created Aug 11, 2022 Views: 266 Replies: 1
Viewing posts 1 to 3

Hello again, just wanted to ask about a problem which is annoying me.

Like in other games, such as in transit bus in cod bo2, we have seen that the player MOVES along with the bus as soon as the bus starts when we are inside. But when we are outside the bus and the bus starts, we are still.

I have tried so much to overcome this problem but can not find a solution. When I move out of my vehicle and if it is still moving, a net force acts on me which is parallel to the direction of the bus. I do not know how to remove it. Kindly help me with my problem. Your help will be appreciated.

Moderator moved this topic to General Development
Moderator(+1)

Hey there,

If I understand correctly, you are talking about the movement of the vehicle to impact the player when they stand on it.

Depending on what tools you use to develop your project, the main idea is to keep track of how many objects are on top of the vehicle. When the player steps on it, add that player to that list.

Now when updating the vehicle’s motion, apply the same amount of offset to any object on that list. When an object gets of the vehicle (like when the player jumps) remove them from the list, until they step on the vehicle again.

This explanation is a bit vague because I’m not sure what tools you use, but hope it helps give you the right ideas.