Angry bird orthographic 3d approach

Updated on April 29, 2020 in [A] Unity Scripting
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
2 on April 28, 2020
hi, i want to create a game like angry birds but in orthographic mode 3D .
i want to give the player the ability to Jump to the Red and Blue Platform with the Click, Drag  and release 
however i dont know how to ge the exact direction wanted by the player and with the orthographic view
[ICODE]Camera.ScreenToWorldPoint(Input.mousePosition)[/ICODE]
it gives me a weird vector
so i would like to hear ur approaches to solve this.
  • Liked by
Reply
1 on April 29, 2020

You can use for your player gameobject the OnMouseOver() OnMouseExit() functions.

https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseOver.html

In it you can declare a boolean for your other code. Something like:

void OnMouseOver() { isMouseOver = true; }
 void OnMouseExit() { isMouseOver = false; }

With it you can just ask if isMouseOver and Input.GetMouseButton(0) equals true, then the player object follows the mouse cursor. Then if GetMouseButtonUp(0), it places itself to the nearest possible block. Something like that.

on April 29, 2020

Thank youuu, you just gave me a very goood idea 😀 which can improve the gameplay alot 

Show more replies
  • Liked by
Reply
Cancel