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 AW0610AUT · Jan 07, 2014 at 07:16 PM · gravityspacephysics settings

Newtonian physics in a space game

Hello, I am developing a Sandbox/Space adventure game. But i want the player to be able to get in his Spacesuit and leave his station. However as of now i dont know how to write a script that would change the behavior of the player when he leaves the Station (Inside the station is gravity). How would i do that? Any ideas?

Thanks in advance.

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 Patrykgazing · Jan 07, 2014 at 07:20 PM 0
Share

I would set gravity to 0, 0, 0 and let the player move on y axis as he wants. It's just "my tip"

avatar image AW0610AUT · Jan 07, 2014 at 07:33 PM 0
Share

But how do i make him move in the direction the mouse points? if i set gravity to 0 he still moves as he is on a platform he is just not falling. And also how do i make it so he doesnt stop after releasing the key for movement(just like it would be in space if you apply force to a body and nothing works against it it wont stop)

avatar image Patrykgazing · Jan 07, 2014 at 07:42 PM 0
Share

Example for moving forward: transform.Translate(Vector3.forward * Time.deltaTime, Camera); I don't know how to do 2nd thing but i guess it's something similar to sliding.

avatar image robertbu · Jan 07, 2014 at 08:21 PM 0
Share
  • Add a rigidbody component

  • Turn off gravity

  • $$anonymous$$ake sure 'Drag' is set to 0

  • $$anonymous$$ake sure 'AngularDrag' is set to 0

  • In your script use Rigidbody.AddForce() to move your object

1 Reply

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

Answer by HappyMoo · Jan 07, 2014 at 08:13 PM

Turn gravity off on the rigidBody... useGravity=false

and use addForce whenever he turns on his spaceshuit boosters or throws something away or pushes himself away from something.

Also make sure you put the right mass on the rigidbody etc...

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

20 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

Related Questions

Drift Rotation 1 Answer

Newtonian Gravity 2 Answers

How do you create a continuous physics simulation in Unity? 1 Answer

Gravity y is stronger than x 0 Answers

How to get the Half-Major axis of a 2D collider ? 0 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