Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Constrain particles on axis
#9
(22-02-2019, 02:02 PM)josemendez Wrote: 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.


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.


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
The trivial c# problem you think is method? And constrain on YZ plane means particle move on the plane, is it OK?
Reply


Messages In This Thread
Constrain particles on axis - by Richard - 22-02-2019, 09:38 AM
RE: Constrain particles on axis - by josemendez - 22-02-2019, 10:37 AM
RE: Constrain particles on axis - by Richard - 22-02-2019, 11:08 AM
RE: Constrain particles on axis - by josemendez - 22-02-2019, 11:27 AM
RE: Constrain particles on axis - by Richard - 22-02-2019, 12:22 PM
RE: Constrain particles on axis - by josemendez - 22-02-2019, 12:57 PM
RE: Constrain particles on axis - by Richard - 22-02-2019, 01:22 PM
RE: Constrain particles on axis - by josemendez - 22-02-2019, 02:02 PM
RE: Constrain particles on axis - by Richard - 22-02-2019, 02:49 PM
RE: Constrain particles on axis - by josemendez - 22-02-2019, 03:01 PM
RE: Constrain particles on axis - by Richard - 22-02-2019, 03:31 PM
RE: Constrain particles on axis - by josemendez - 22-02-2019, 03:46 PM
RE: Constrain particles on axis - by Richard - 22-02-2019, 03:55 PM
RE: Constrain particles on axis - by josemendez - 22-02-2019, 06:44 PM
RE: Constrain particles on axis - by Richard - 22-02-2019, 11:35 PM