22-02-2019, 02:02 PM
(This post was last modified: 22-02-2019, 02:04 PM by josemendez.)
(22-02-2019, 01:22 PM)Richard Wrote: Hello.
That is a hard problem for me.
That's why you should read more on the subject (Unity, C# and basic vector algebra) before attempting to use advanced physics simulations. The problem itself is trivial, you just don't have enough knowledge to tackle it yet. Asking others to solve it for you is not going to help you in the long run, at all.
(22-02-2019, 01:22 PM)Richard Wrote: In case of public static Vector3 Project(Vector3 vector, Vector3 onNormal);, Vector3 vector means actual movement of particle (with nothing processing) and Vector3 onNormal means direction I want them to move.
Yes, the "vector" variable should be the vector you want to project, in this case the particle's velocity. "onNormal" should be the vector you want to project it onto, in your case the axis.
(22-02-2019, 01:22 PM)Richard Wrote: if I constrain on y and z axis, vector3 (0, 1, 1)), and then Vector3 Project is how I would like them to move?
I think you're mixing up vectors and planes. Constraining something to move on both Y and Z (or X and Z, Z and Y) is done by projecting to a plane, not a vector. By projecting velocity to a vector you essentially get rid of all movement except along that vector.
So by projecting to (0,1,1), you're making particles move only along the (0,1,1) vector, which is a diagonal line crossing the YZ plane.
To allow a particle to move only in the YZ plane, you'd have to use Vector3.ProjectOnPlane. You'd then pass (1,0,0) as the plane normal.
https://docs.unity3d.com/ScriptReference...Plane.html