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
1
Question by sonic lover · Aug 08, 2013 at 08:05 AM · gravitywalkingplanetwalkshapes

Walking & Gravity

Hi Everyone! I wanna do a game that every level in the game is a huge shape (like cube), and basically - I walk on this shape (actually there is more shapes like moons on the biggest one).

But since I am not good in unity and I don't find any teacher or something, I don't know how to do the basics of this game - gravity to the main shape, gravity to eack moon shape, the ability to jump from shape to shape, the camera that will be changed when I'll change side of the shape (or allways, if the shape in ball), and I dont know how to do that the player will walk like the camera, wont fall while turning from side to side, (and actually I don't know how to rotate him too).

If someone will teach me all that I would be thankful to him very much. My skype is yonisimian (I don't think that it is possible to include all this codes in one answer, and besides - I also wanna learn from this, not just copy :) .

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by fardinnn · Aug 08, 2013 at 08:39 AM

use Physics.gravity = Vector3(gravity direction * size) you can Obtain gravity direction in several ways : 1 : if your shape is simple by center and rotation of model and your position calculate the direction 2 : the simpler way is send a ray from you position to center of shape and coll that shape , then get surface normal , for this you can use : Physics.Raycast http://docs.unity3d.com/Documentation/ScriptReference/Physics.Raycast.html and RaycastHit.normal http://docs.unity3d.com/351/Documentation/ScriptReference/RaycastHit-normal.html

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 save · Aug 08, 2013 at 08:55 AM 0
Share

A small note to this, if you have several rigidbodies that uses gravity you would be better off controlling each rigidbody separately to set their gravity direction as described in answer. In other words rigidbody.AddForce(normalizedGravityDirection*gravity).

avatar image
0

Answer by Marksmir · Aug 08, 2013 at 08:22 AM

Sounds like you have no unity experience- if I was you I would pay a teacher for some basic lessons (should only take about 6 hours). However I can say that you can do the gravity but clicking on the shape then inspector then gravity (tick box). The controller is a fairly simple script- if I were you I would download it from the assets or something. The player (first person) is an object (can't remember of the top of my head for some reason which object it is.) Basically you create an object- drag the camera onto it as a main object and add the first person script to it.

Hope this helps!

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

17 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

Related Questions

How to make a character walk on a 3D cube planet and a long 3D cube planet using gravity? 2 Answers

Unity 2D Cube Planet Gravity 0 Answers

Adding a force(gravity) to a planet. 0 Answers

how to apply orbit to the player 2 Answers

Implementing FPS view into locomotion planet walk 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