I would like to know whys in which one can spawn skateboard under player like we see in subway surfers.

My best two guesses are, 1.Spawnning skateboard and then making it child of player. 2.Changing current child prefab of player with skateboard attached prefab.

With first approach ,its get complicated to know exact character's leg position.

What you think is the best way? if you know any other good way then please mention .

Thanks in advance

  • \$\begingroup\$ Have you tested any of your theories yet? I'd recommend testing on your own before you ask for help. :) \$\endgroup\$ – Sturlen Nov 12 '15 at 11:31
  • 1
    \$\begingroup\$ Yes I do tried first one, bt not able to work \$\endgroup\$ – idurvesh Nov 12 '15 at 11:54
  • \$\begingroup\$ What technique are you using for animating the player-character? Depending on how you do it, finding the animation bone to attach the skateboard model to might be quite trivial. \$\endgroup\$ – Philipp Nov 12 '15 at 14:31
  • \$\begingroup\$ @Philipp yes but how to adjust player position to such that skateboard will be under player i.e., properly on ground and player will be on skateboard \$\endgroup\$ – idurvesh Nov 12 '15 at 15:27
  • \$\begingroup\$ @idurvesh depending on what technique you use for animation (that's why I asked), the feet position is usually relative to the root bone, which is often the spine of a humanoid character. And you certainly want other animations during "skating" than during "walking", so you would design the skating animation to account for the height used by the board. \$\endgroup\$ – Philipp Nov 12 '15 at 15:39

You can create a new empty game object as a child of the player and align the board up to attach in such a way similar to how you would attach a weapon or anything. Once you got that working you could either instantiate the object on the game object position or simply enable and disable the board when needed.

  • \$\begingroup\$ The problem with skateboard is, player position too needs to be adjusted from ground ...so its not quite similar to weapon....My hierarchy structure is Parent with movement script -Child with main scripts -Character model \$\endgroup\$ – idurvesh Nov 12 '15 at 15:26
  • \$\begingroup\$ that is easy enough to set the players new position on Instantiating or enabling the board or you could have a bool isOnBoard to handle whether or not to use the new position. \$\endgroup\$ – Justin Markwell Nov 12 '15 at 15:31
  • \$\begingroup\$ Yes I can spawn skateboard under feet bone.But thing is my model do not have any rigid body or gravity applied to actual model (iits on parent of it) so when skateboard gets spawn,it gets below surface area of ground \$\endgroup\$ – idurvesh Nov 12 '15 at 16:00
  • \$\begingroup\$ yes you would want the board to have a collider so that wont happen \$\endgroup\$ – Justin Markwell Nov 12 '15 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.