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 Kaili-chan · Oct 03, 2012 at 11:53 PM · physicsvehiclerigid bodyridigbody

Physics based vehicles made from rigidbodies

I have an empty game object that I consider the root object for a bunch of prefab cubes of type, Regular, Weapon, and Movement.

Block Types: Regular: provides structure and a place for other nodes to attach. Weapon: attaches to Regular nodes and can shoot. Movement: provides thrust in a desired direction.

Block Prefab Contents: Blocks consist of: Script for controlling that type of block, a 1x1x1 cube primitive, rigid body with gravity enabled and a mass of 1, cube collider.

So with these block types you create a vehicle. Adding them all to 'root' empty game object node.

On your movement function you apply force to your engines and that is when it all breaks down.

I want to move all the cubes as one unit. I figured one way is to add fixed joints to each of the nodes and add it's adjacent node. This worked alright except there was some noticeable jiggle if I messed up thrust and the ship toppled over. It didn't look 'glued' together. How do I make these blocks stick to each other while manipulating the 'thrust' from my engines and make the entire ship behave as a single unit.

Edit: So one possible solution is to remove the rigid bodies from all the individual blocks, add one to the root gameobject that everything is a child of and add force to that. It will work well enough but what are the options for an entire physics based vehicle that is created from modular parts?

Comment
Add comment · Show 4
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 Kaili-chan · Oct 04, 2012 at 02:20 PM 0
Share

They do have the same parent, It's the empty game objects I called 'root'. I'm taking about using physics on the entire thing with discrete physics calculations per block.

I might just have to fake it and use math to calculate what the characteristics should be for a vehicle

avatar image Kaili-chan · Oct 04, 2012 at 02:57 PM 0
Share

I can provide a screenshot when I get back to my machine. But I thought I summed up what I did pretty well in my question. I have blocks with rigid bodies I added fixed joints to each of the cubes to link them together as if I was welding. But it doesn't look like the joins are completely solid, if the object hits something too hard the 'ship' will jiggle as if the joints are made of jello.

avatar image Kaili-chan · Oct 04, 2012 at 03:54 PM 0
Share

The problem is I have a group of individual blocks each with rigidbodies and 4 movement blocks that apply force down to lift the object. Is there a better way to do that?

avatar image Kaili-chan · Oct 04, 2012 at 05:49 PM 0
Share

Yeah but I'm at work, I can't try anything out or post pictures, because I don't have my project.

1 Reply

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by nixtwiz · Oct 04, 2012 at 05:48 PM

Why are you using multiple rigidbodies? If you want them to all appear "glued together" then the root object is all that needs a rigidbody. Just make the Empty Gameobject that is the root be the only object with a rigidbody and everything that is a child of it will move with it. It will take into account all of the children collision meshes.

As for having multiple thrust locations, just use rigidbody.AddForceAtPosition and use the different locations you were trying to set as separate "thrust" rigidbodies.

Rigidbody.AddForceAtPosition Script Reference

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 Kaili-chan · Oct 04, 2012 at 05:50 PM 0
Share

AddForceAtPosition is totally going to solve my problems. Thanks for that, I was exhausted yesterday and should have just rested rather than tried to program anything.

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

11 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

Related Questions

fast forward physic vehicles 0 Answers

How do you not allow a car to flip with Edy's phyics? 0 Answers

Bouncing off Walls in C# 1 Answer

Problem with Rigidbody2D: Objects are sticking together when instantiated? 0 Answers

Vehicle programming source 5 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