Jumping on a Train

chrisk

Active member
Hi, Justin,

I'm trying to implement jumping on a train and read this in the document section where it says the following.

The moving platforms are a generic term meaning any object that can be moved/rotated within the scene. This includes elevators, trains, revolving doors, etc. The character can ride on top of or get pushed around by these moving platforms.

Requirements
In order to stay properly synchronized with the character and camera the object must use the Moving Platform layer:



The Moving Platform or Animator Update component must be added to your movable object.

The train has its own controller and it's not exactly a moving platform where it moves on a predefined path, therefore I would like to use Animator as you mentioned above.

Could you please explain how I can do this? If it's doable for a train, I guess I can solve getting into a car the same way.

Thanks.
 

chrisk

Active member
Hm... I see. it assumes it moves using the animator. It's not going to work because the train has its own controller.

Justin, unlike a vehicle where I disable UCC and use simple parent, the character needs to move around. I'm not sure how to solve this problem.
It's not a problem just for the train but I think we need a general solution how to ride on non-UCC moving object.
Any idea how to solve this problem?

Thanks.
 

chrisk

Active member
Justin, here is an idea.

I can detect if the character is on the train or not by setting a trigger.

And we need to do the following two steps.

1. Probing train's delta position. It can be done by registering the object to DeterministicObjectManager with a special flag so that the object can move independently by its own physics system rather than within Move().

2. And then move the character the same delta amount.

And importantly, you need an option to disable character's movement input, depends on your character is fixed in position, e.g., sitting in the vehicle.

It seems like the correct solution but the thing is Deterministic Movement system is very complicated and it isn't easy to figure out how to put things together.

Please help!

Thanks.
 

Justin

Administrator
Staff member
Take a look at the IDeterministicObject interface - this is how the moving platform and animator update script ticks within the correct order. You'll need to implement the IDeterministicObject.Move interface for your vehicle then your vehicle will be updated at the correct time with the IDeterministicObject.Move method. The AnimatorUpdate script is actually a really simplistic use case for this so is a good example.
 

chrisk

Active member
Yeah, having the 3rd party vehicle to update within UCC framework is exactly the problem.
Since there are many different 3rd party assets, it will be quite difficult to modify them all individually.

I rather would like to make a solution for UCC to adapt to different situation. This way, users don't have to come up with fixes everytime when dealing with 3rd party asset.

Would you help to make two APIs?
1. Turn on/off UCC movement.
2. Add delta position to the character movement. I'll then add the delta position to the character from the Move().

With those two APIs, I think we can adapt to many different situations.

Thanks.
 

Justin

Administrator
Staff member
This next update has made a lot of major changes and because we are more in the testing/animation phase I don't want to add anything new. I'll be doing a quality of life update after the agility pack release and will see what the best approach is then.
 

chrisk

Active member
FYI, I found one more problem. When jumping on a moving platform horizontally, the character's momentum is ignored.
 
Top