• 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 Sisym · Jul 23, 2015 at 05:38 PM · transform.positiontransform.forwardflicker

Placing an object in front of another object using transform.forward causes the position to flicker

I had a question earlier concerning this problem, and I figured out that it was not the rigidbody that had been causing the flickering position, but that by using objectA.transform.forward (I'm calling the object behind the other object objectA, and the object in front of the other object objectB) in the script of objectB was causing the position of objectB to flicker. Using objectA.transform.position had no flicker when I looked at it in the scene view.

Here is the script in objectB that I am using

 void Update () {
     transform.position = attachedObject.transform.position + Vector3.up * 2;
     //rb.MovePosition(attachedObject.transform.position + attachedObject.transform.forward + attachedObject.transform.right/3 - new Vector3(0f, .35f, 0f));
     //rb.MovePosition(Vector3.MoveTowards(rb.position, attachedObject.transform.position + attachedObject.transform.forward/1.75f + attachedObject.transform.right/3 - new Vector3(0f, .35f, 0f), Time.deltaTime * 5));
     //print (attachedObject.transform.position + attachedObject.transform.forward/1.75f + attachedObject.transform.right/3 - new Vector3(0f, .35f, 0f));

Is there a smarter way of placing an object in front of another object, and why does transform.forward give inconsistent results?

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 arvindiitkgp · Jul 23, 2015 at 08:41 PM

If you have rigidbody attached to any of them then set interpolate to interpolate or extrapolate, And if none of them is working then use Vector3.Lerp to put object2 to the forward of object1. If you didn't get the result then please explain a little :) Hope this will help :)

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

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

Rotate AI towards nearest target within sphere collider 2 Answers

My object is translating with speed but does not stop... 1 Answer

Trying to position a world space menu in front of the camera whilst ignoring the camera's tilt angle 1 Answer

Bayonet Action Transform 0 Answers

Object positioned at wrong location 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