How could I draw a spline onmousedown,and add rigidbody to this spline,I am a newbie.
If possible,please give me the code or give me the demo!
Thanks a lot!
Unity is amazing!
![]()
Hi, welcome to the forum!
There is a script in this thread that implements the Catmull-Rom spline. How you plot the points depends on what you need to do in the game. Are you drawing the curve in space, on a flat surface, terrain… ? As for the rigidbody, it is not all that straightforward to make it follow a spline path (there’s no spline joint or anything similar). Can you give any more information about what the rigidbody is doing in gameplay?
HI andeeee
Thank you for your return card.
I want to draw a curve when the mouse moveing
if mouse up
The curve became to a rigidbody,It has the Gravity.
and my player can walk on it ,
can you help me?
Thanks a lot!
I’m drawing shapes using LineRenderer.
Declared: private LineRenderer line;
Then in Awake, line = gameObject.AddComponent();
It gives me a complete shape when i connect the start and end. At this point, i want this shape to become rigidbody and gravity and collision applicable to it.
How to achieve this?