unity3d - How to make object fall in line with the target when applying wind effect? -
i making paper toss kind of game in unity3d. implementing wind effect using constant force. wanted know how create object fall in line target ie, if object gets on target, should go in or fall in line target, not go behind or in front end of target. @ nowadays when swipe applying constant force, different angles of swipe distance moved object differs. help much appreciated.
in fixedupdate
, utilize physics.raycast
check see if object on target. if so, set x , z values of rigidbody.velocity
0 (assuming y up/down axis in game world) , disable constantforce
component (i.e. gameobject.getcomponent<constantforce>().enabled = false
). note won't realistic of movements, seem object moves straight downwards when goes on target -- sounds that's want.
unity3d swipe
No comments:
Post a Comment