Game Task: Sliding

08/01/2020

I try to build the first playable task for our game.

The task is aims to moving the desired object to a specific location. Once the player move to a direction, the object will not stop moving until it hits an obstacle.

First, I put the cube as a chessboard.

circle: player/desired object, orange box: goal

And then, I add the code on the object we want to move. But the object will ignore the obstacle and keep moving after player input one movement.

To solve it, I add “Box Collider" to all obstacles. However, it caused a new problem. The object will stop in a weird place where is not supposed to stop the object.

object can not pass though

The problem probably is happened due to the collider size so I try to scale the box collider size. It seems work at first, but the same problem happens on other place.

I try to think if I am using wrong way to move the circle object. At first, I used RigidBody.AddFroce function to move the object. After I got this thought, I change it to Vector3.MoveTowards function. But it still can’t solve the problem.

發表留言