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
0
Question by THDevelopment · Jul 15, 2014 at 11:04 AM · lookatmovetowardstargeting

MoveToward and LookForward problem

uhm i want to move my main object between two vector3.points - the following code should move it between the two points. (it works but the problem is that this gameObject isnt grounded when it is moving)

wolf.transform.position = Vector3.MoveTowards(currentPos, targetPos, step); wolf.transform.LookAt(Vector3(characterPlayer.position.x, transform.position.y, characterPlayer.position.z));

you can see i use Vector3.MoveTowards and transform.LookAt. Basically im not sure if it is possible to move this object on the ground if i use this two functions, because it interpolates the height of the two target Points (vector3) i have made.

on the wolf, there is a character controller which i gave a gravity in my code.

my question:

1.is it possible to make a object grounded, if it uses two target points i set up in my scene? i have to call the x and the z axis and not the y axis if i want to give him the target.coordinates

like wolf.transform.position = Vector3(targetPoint.x, ?????, targetPoint.z);

i dont know how to declarate that the wolf shouldnt orientate the y position of the target points - but how can i do that? or is it basically possible?

  1. The Colliders doesnt work. The GameObject goes trough the ground mesh and trough obstacles i`have placed in the scene. is there a reason for that?

i hope someone has some experience with that kind of problem. or an alternative how i can move the object between the two targets - without MoveTowards and LookAt function.

Thank you so much :)

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 THDevelopment · Jul 15, 2014 at 12:33 PM

do someone got an idea? this problem is very frustrating...

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

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

Related Questions

Object moves toward another object when close 2 Answers

lookat wont track target 1 Answer

Move n-Objects in a row to a point "B", looking at it 1 Answer

How Would i toggle the LookAt Off, so object faces origin 1 Answer

LookAt but using physics AddRelativeTorque 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