Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 tuf91497 · Jan 28, 2019 at 10:22 PM · scripting problemtransformtransform.translate

Is it possible to do inverse transformations, instead of moving complex groups of objects?

CONTEXT

So I have a fairly simple room that is marked as static, and a complex geometry with a few hundred box colliders on it in the middle of the room. I know that's a lot of colliders. My game is in VR, which has trouble with mesh colliders for some reason. I think it has to be convex or something and then you're limited to 255 verts, but my object is concave and has tens of thousands of vertices, so getting a simple mesh collider to work would be a headache. My object and its colliders are also generated at runtime (shoutouts mynameisjacob for this awesome compound collider generator), so simplifying my mesh within Unity in order to make a simplified mesh collider for it also seems like it would be a headache.

So I have a simple static room with a complex object. This works well when the object isn't moving, but I need to grab the object and move it. This causes massive a performance drop whenever the object is moving since every frame (or more) the CPU needs to update the transform of each collider. I'm looking into simplifying this and running it in parallel using the new ECS and Job System, but I still want to look into my question for possible further performance gains.

MY QUESTION

If I have a large group of transforms that I need to move at once (My complex shape with a 600-box compound collider), and that is the only thing in my environment that is going to move at any time, is it possible/convenient to move my environment relative to the object, instead of moving my object relative to (0, 0, 0) in world space? Instead of moving my 600 colliders, can I move my static environment and lighting around the object, so that the effect is exactly the same, but fewer transforms need to be updated?

Simple example: I grab my object and move it from (0, 0, 0) to (1, 0, 0) and the object's rotation moves from (0, 0, 0) to (90, 0, 0). Is there a simple code implementation to instead move all of my static marked objects from (0, 0, 0) to (-1, 0, 0) with rotation (-90, 0, 0), so that you as the user cannot tell the difference, but fewer objects have had their transforms altered? Or would it require simply saving all of my static objects in an array and running through their transforms with a for loop, doing the math each frame to find the inverse transform? Cause that seems too inefficient.

Comment
Add comment · Show 2
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 Magso · Jan 29, 2019 at 01:20 AM 1
Share

You could have a duplicate of your object with fewer colliders and switch between them using gameObject.active, unless you need it to collide accurately with the environment.

I wouldn't recommend moving the environment itself, which you could do by parenting the whole lot to an object at the players position and moving it negative to the player. You'd have to keep reparenting it to bring it to the players new position.

avatar image tuf91497 Magso · Jan 29, 2019 at 07:38 PM 0
Share

I think this is the answer. Thank you

0 Replies

· Add your reply
  • Sort: 

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

190 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 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 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 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 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 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 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 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 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

Trying to make an object "Flee" from the player but it won't work? 3 Answers

How to make a world-space UI panel that can find an open position in the world? 0 Answers

Line render from an object to a click 0 Answers

My gameobject only moves to the right once and then stops, why? 3 Answers

transform.Translate not working after exporting to Android 2 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