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 Freelanzer · Jan 06, 2012 at 09:02 PM · movementspeedspheretargetspace

Move object from A to B on sphere

Hi there,

I basically need to make a spaceship fly from point A to point B on a planets surface (or at a certain altitude). I've tried looking into RotateAround, but it's really strict not really what I was looking for.

What I'm looking for is:

  • Rotate around earth (placed in Vector3.zero) at a radius of 4975.

  • Move from point A to point B on the surface of earth, no slerp/lerp.

  • Parent needs to LookAt target, point b (Only rotate around Z-axis).

  • Child already has a script to make it LookAt Vector3.zero.

The ships gameobject consists of a parent called "Interceptor". A child of "Interceptor" called "ShipLookatZero", this basically only rotates it's child "ShipModel" so the ships bottom always faces Vector3.zero.

The variables I'm thinking would be great here is:

 var startPoint : Transform;
 var endPoint : Transform;
 var shipSpeed : float;

Could the awesome Unity community help me out here?

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by mpavlinsky · Jan 06, 2012 at 09:12 PM

I think for the most part you want to make your ship a child of an 'anchor' object, just a transform at the position you would like to rotate around, in this case the center of the planet. Then you can just set the ships local position so it is the proper distance away from the anchor, preferably down the forward axis so then you can just have the anchor LookAt the point you want the ship to go and it will end up there.

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
avatar image
0

Answer by Freelanzer · Jan 07, 2012 at 12:57 AM

Hmm I don't really know to set it up correctly. This is what I apply to the child of the Vector3.zero anchor.

interceptorNav.js

 var startPoint : Transform;
 var endPoint : Transform;
 var shipSpeed : float;
 
 function Start () {
     transform.position = startPoint.position;
 }
 
 function Update () {
     transform.localPosition.x = transform.localPosition.x - Time.deltaTime * shipSpeed;
     transform.LookAt(endPoint.position);
 }

Here's a screenshot of the parent tree and the inspector of the child of the Zero anchor: http://i.imgur.com/JheYf.jpg

And here's the unity file if anyone can take a look at it and point out what the issue is: http://freelanzer.com/interprob.unitypackage

I really wish I knew how to do this.

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.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to make an object without Rigidbody move at the same speed as an object with Rigidbody? 1 Answer

character(ball) rolls with less speed when I build it 2 Answers

Why is my character so slow? 1 Answer

Movement Bug 1 Answer

Is mixing movement types a bad thing to do? (Force and Translate) 1 Answer


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