How to make 2D Top-down shooter controller with camera follow (And camera follow cursor.)? Like a diep.io, etc. (But little bit different.)
Using movement key is WASD.
I’m planning college group task. (And my department is Computer Programming.) My teammates are 3 people including me. But my team does not much know how to write a script. They also have the same department as me.
I want to make a better game, but sometimes I get confused. Can somebody help me? (I’m still confused.)
I’m using Unity 2018.3.12f1 (x64 Windows).
Like a regular camera follow, but camera should actually follow a point inbetween the cursor and the player. You’ll need the following.
- create a Ray object going from camera through mouse cursor
- Physics.Raycast that ray to the ground and find where on the ground the cursor points
- lerp some position between the player and that point. 25% is nice, for example
- move the camera to that position and offset up to the desired height
- set camera forward vector to minus offset
Can you show example to me?
Of course. Look at the gameplay video, this is how I made camera for that game: Techwars: Global Conflict on Steam
1 Like