Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • 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
1
Question by Karsnen_2 · Nov 20, 2012 at 04:59 PM · c#ioslogic

Ride across a tree?

Hello,

I have an object (Player) who is falling from a tree. Now when the object hits a concerned object, I want the player to move around the tree. At this time, the control is disabled from the player. Before hitting the concerned object, the camera is placed to the top of the GObject and it follows it during it's journey. Now it has to snap to the GObject (Player) before take-off. We could disable the GObject untill the journey is finished.

Description :

Upon hitting an object, the camera has to come to the player and he has to fly around the area. The area is defined by the radius from the center (trunk).

Experience :

It is just a round-a-bout around the trunk of the tree. The ride is the experience of a journey around the tree. There is a start and that journey ends at certain point. That end could be based of time or a position. Once it ends it's journey, the camera re-positions itself.

Constraints :

  1. There is a trunk at the center. Hence he cannot pass through the trunk.

  2. Area of Radius 'r'. i.e. He can travel between the radius 'r' from the center and can't pass thro' the trunk.

  3. The Player usually is falling down. Hence upon obtaining this, he has to go up & not down.

  4. The 'path' of travel has to be defined during runtime.

Possible Solutions/ Problems :

  1. Use Prime31's Go Kit.

  2. When the camera zooms to the player, the player disappears and the camera flies around. It then checks the final position. How do I zoom in? I cannot use Lerp or Slerp as they might be really slow to snap to the player before take-off.

  3. Once it reaches the final position, it re-position itself to have the GObject back in view.

Thank you and I would like to know if I have missed any information to make things comprehend-able.

regards,

Karsnen.

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
1

Answer by sparkzbarca · Nov 20, 2012 at 08:42 PM

is this for a phone or a pc game?

Using raycast to keep the feet of a player always attached to the tree would be an easy way to make sure that as the player moves the bottom of his feet remain parallel to the normal of the hit point on the cylinder (tree).

something like

 raycast(from player to -player.up, out hit);
 
 raycast(from hit.point to player, out hit2);
 
 rotate(from hit2.normal to hit.normal in axis cross(hit.normal, hit2.normal));

now the feet will remain parallel so just tell the player to go forward. the circling of the collider will resolve its own self.

turning as well is allowed you can move however you want around the trunk and you will alawys have your feet against it . The ground is now the cylinder.

He won't pass through the cylinder as long as its a collider.

he will be allowed to move up if you disable gravity or disable gravity on him or mark his as kinematic for the journey.

Your path can be whatever you want you can feed it a path or the player can run it themselves.

Lastly you can in fact lerp to the player just do a lerp whereby the further you are from the player the faster the speed.

 speed = vector3.distance(player, camera);
 now the greater the distance the greater the speed
 
 lerp(from, to, time.deltatime * speed);


I think that covers just about everythign. :)

Comment
Add comment · Show 1 · 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
avatar image Karsnen_2 · Nov 21, 2012 at 06:22 PM 0
Share

Thank you very sparkzbara. I am working on it. I think I get the logic behind it.

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.

Follow this Question

Answers Answers and Comments

10 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

What is the best way to understand code in a project with null documentation? 2 Answers

Multi Touch Drag Screen To Move Player? 1 Answer

Pause Game When Function Is Enabled? 3 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges