Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Player move with object
#1
Hello, I am looking at buying this asset on the unity asset store, but before I do I would like to know if it is possible for a player (with a character controller component) will move with an object that is animated along a spline while they are on that object?

Here is the specific scenario I am trying to create: I have a train, that is animated along a spline. I have a player character that is set up using the unity starter assets FPS character controller. I want the player to be able to get on the object(train) and move with it when it moves.

I have tried other spline assets such as the unity built in spline package, dreamtech splines... and none of them will work like this. The object simply moves right out from under the player and has no effect on the player at all. I know that this is how unity works by design and I also know there are hacky ways to make this work, but my question is does this asset support objects "riding" on the object that is animated along the spline?

Thanks!
Reply
#2
Hi,

When the Curvy Spline controllers compute where an object should be place, they move the object using either (depending on the value of the Target Component setting):
  • Transform.SetPositionAndRotation
  • Rigidbody.MovePosition
  • Rigidbody2D.MovePosition
In other words , the controllers simply moves objects, nothing special is done to handle riding. If your character controller works with a character riding for example a cube that moves under it (moved by some simple script), then it will work with Curvy Splines. The opposite is also true.

I am not familiar with the starter asset's FPS character controller, so I can't give advise specific to it, but the solution I thought of is to make the character a child of the train. This way moving the train moves the character too, and the character controller moves the character relatively to the train.

I hope this helped. Let me know if you have further questions.
Have a nice day
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#3
Thanks for the response. Yes I have already tried parenting the player to the object. It does not work and I am quite certain this is due to the way the unity character controller works. Removing/disabling the character controller and the player will stay on the moving object, however, as expected, can no longer move due to the character controller being disabled.

The reason I was hopeful about this asset is because I believe moving the object with physics might actually work. I just would rather avoid spending $80 bucks to find out it doesn't work. Unity, as you are probably aware, does not issue refunds on assets once downloaded, regardless of whether or not you are within the refund period.
Reply
#4
In case you didn't notice it, I send you a private message on Saturday which might help you.
Please consider leaving a review for Curvy, this helps immensely. Thank you.
Available for freelance work—feel free to reach out.
Reply
#5
Sorry, I did not see it. I will check it now. Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Bug: Save Generator Outputs still saves outputs if object is disabled curvymesher 1 3 08-30-2024, 09:19 AM
Last Post: _Aka_
  Removing the objects behind an object alms94 6 11 12-06-2023, 09:31 PM
Last Post: _Aka_
  Getting object on spline Position when Spline has coordinates larger than 2000 velikizlivuk 5 11 09-05-2023, 01:01 PM
Last Post: velikizlivuk
  Moving object down or up the spline using gravity velikizlivuk 6 20 07-26-2023, 10:06 PM
Last Post: _Aka_

Forum Jump: