• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by jason 2 · Jan 04, 2011 at 04:23 AM · animationplatformerrigidbodiesmoving-platformmove-with-moving-platform

Problem with moving (animated) platforms. need script to keep player object on

ok so i have a platform which is actually an airship animated into my game. the ship is a rigid body, and has colliders set so it's a solid object.

i can jump on it with the player and move around it while the ship is STATIONARY, but when the animation starts to move the ship the player does not move with the ship, and will after a second fall through the ship. i can stay on the ship if i keep the player constantly moving.... but not standing on the ship.

i've seen a few parent / child scripts out there that claim to fix this but nothign has worked so far for me.

is anyone able to help me out with this? thanks

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by cregox · Mar 29, 2011 at 08:40 PM

Parenting your player on the ship is a very good solution. Here's an instance I've used in a real case:

function Update () {
    transform.parent = GetGroundTransform();
}

The GetGroundTransform method will depend on your character controller implementation. In this instance it should return a transform with the ground object or null if none.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

moving platform jumping and then continuing it's path 0 Answers

Platforms again.. Working but.. 0 Answers

Stay on Moving Platform without Character Controller 1 Answer

Keeping the player on a moving platform? 0 Answers

Rigidbody on a moving platform 5 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges