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 brae · Jan 16, 2013 at 02:34 AM · rigidbodyskateboard

Moving skateboard up an incline surface such as a ramp wtc

Hi there, I've just started using Unity recently to produce a skateboading game project with my co-student so please bear with me, as I have minimal coding skills. I have been looking at an issue that Ive had with smoothly translating a boards movement up an incline (a ramp) of a max angle of 90degrees. At the moment we are using a rigid body with an applied force along with a box collider, as stated before our coding skills are still at a novice level so we have minimal code to show you guys sorry. We have been experimenting with javascript and have looked into aspects such as raycasting etc but still no results that come to our standards. We would learn to understand and begin coding from the very start but my co student and I are on a strict timelimit and would just not have enough time to learn all that we would need to start it from scratch. Any help on this issue would be greatly appreciated, thanks.

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 CodeMasterMike · Jan 16, 2013 at 09:46 AM 0
Share

What is the problem/question you have? Isn't it working with physics or what do you need help with?

avatar image brae · Jan 16, 2013 at 10:47 PM 0
Share

Yes it is to do with the rigidbody physics, we want to add a force to the forward movement to our gameobject (skateboard with a box collider) for it to travel over ramps smoothly that have inclining angles up to 90degrees. We have little idea of how to script this so any help on it would be great. However we were able to find a script in c# which has a very similar idea of what we wanted. Unfortunately we are using javascript so we were unable to understand it properly to change and use it.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by iwaldrop · Jan 17, 2013 at 12:01 AM

As long as both the ramp and the board have colliders and rigidbodies then you should just be able to add a force to the board and watch it fly right up the ramp.

http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.AddForce.html

 function PushBoard()
 {
     rigidbody.AddForce(Vector3.forward * 10);  // replace 10 with whatever force you want to add.
 }
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 brae · Jan 17, 2013 at 12:43 AM 0
Share

function Update() {

   //this is the forward speed that will actually happen

   var forward$$anonymous$$oveAmount=Input.GetAxis("Vertical")*forwardSpeed;
  
   //actual turn amount

   var turnAmount = Input.GetAxis("Horizontal")*turnSpeed;
   
   //rotate the vehicle

   transform.Rotate(0,turnAmount,0);
  
  //push the vehicle forward with a force

   rigidbody.AddRelativeForce(forward$$anonymous$$oveAmount,0,0);
 
  
    }


how do you think we could go about putting that piece that you just tiyped up fit in with our movement script still work if possible

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

10 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

Related Questions

How to add force like a "kick" relative to swipe angle? (Skate game) 1 Answer

Character controller or rigidbody? for skateboard 1 Answer

Rigidbody isn't working properly 1 Answer

How to fix/clamp rigidbody dir vector, despite Force dir 1 Answer

How to change velocity of object which move by Rigidbody. 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