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 crusherxman · Dec 14, 2013 at 08:48 PM · controllermodelnavigationdrive

Snowmobile script (being able to drive it)

Okay, apparently I've been working on a "Snowmobile Simulator", creating maps, creating my snowmobiles for weeks. I actually found this car tutorial on the asset store, I've tried by changing the scripts in order to make it work for my project, I've never managed to get that working. If you look at other games like Modern Warfare 2, whenever you're escaping the cliff hanger, you do make your way to the extraction point with a snowmobile, this actually gave me an idea making my own snowmobile game on Unity. I have my colliders ready up, just need the scripts in order to make it work.

Also, before I end it here, here's a few screenshots of my snowmobile:

alt text alt text

I know this sounds complicated, but I would really appreciate it if you guys could make me a script for my snowmobile :)

Thanks!

unity 2013-12-14 15-43-17-95.png (84.8 kB)
unity 2013-12-14 15-44-35-96.png (66.0 kB)
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
0

Answer by RetepTrun · Dec 15, 2013 at 03:40 AM

I would make it a 3 wheeled car that looks like a snowmobile. 2wheels really close together at teh back and 1 for each ski at the front. And add some white particicles to the treds

And to start I would follow a car tutorial. http://www.youtube.com/channel/UC3H-n_qgipIYB5bJKjlKUIg

Comment
Add comment · Show 7 · 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 crusherxman · Dec 15, 2013 at 04:09 AM 0
Share

I've checked their channel, is it the Car AI tutorial or is it the "How to make a Car game"?

avatar image RetepTrun · Dec 15, 2013 at 04:13 AM 0
Share

How to make a car game. Then the other for bots if you want

avatar image Kiloblargh · Dec 15, 2013 at 04:18 AM 2
Share

This.

I'd like to add that what will make it feel like a snowmobile is careful adjustment of the sideways friction vs. forward friction, having different friction curves for the tread and the skis, and adjusting them based on the ground slope and your turning and momentum. How it loses control in extreme situations is where the interesting stuff happens with any simulated vehicle.

Asking someone to make a script for you to make your snowmobile work is not reasonable. If you're making a snowmobile game, the way it handles like a real snowmobile is the whole meat of the game; and if that's beyond your abilities, take on a simpler game (a 2d puzzle or retro shooter for example) that you know how to do, while you improve your scripting abilities.

avatar image crusherxman · Dec 15, 2013 at 03:05 PM 0
Share

I understand you $$anonymous$$ilo, but I'm not just going to be driving my snowmobile for all the time, here's a few other things I might add during the future:

  • NPCs (bots that follow you or goes anywhere)

  • Different game mode types

  • $$anonymous$$aybe multiplayer (I'm very far from that now, might be added)

In fact, I know a few things in scripts. Still far ahead to know all the commands, maybe I'll be creating my own scripts with the new Unity page (Learn) and might be able to get around my project.

avatar image RetepTrun · Dec 15, 2013 at 05:59 PM 1
Share

Wheelies and flipping over are like the most common thing. You can try making the snowmobile heavier and lower center of mass and adjust engine power in fwd direction. You have to adjust things a hundred times before you find settings you like. Hardly anything in unity is going to work right the first time where you just go model+script_I_may_not_understand=game. Have to customize stuff to make them work together.

You could try the lazy way to keep it simple. 2 box colliders for skis, put some capsule colliders sideways to be the treads, a script with transform.rotate(0,input,0) to spin them around. Voila-powered sled.

Show more comments
avatar image
0

Answer by jabez · Dec 15, 2013 at 04:49 AM

Add a rigid body to your snow mobile Set Rigid body drag settings to 1 add this script to your snow mobile http://pastebin.com/gfxNwQEd

 using UnityEngine;
 using System.Collections;
  
 public class SnowMobileController : MonoBehaviour {
         public float force = 20;
  
         // Use this for initialization
         void Start () {
        
         }
        
         // Update is called once per frame
         void Update () {
 // You may have to change rigidbody.AddForce(Vector3.back*force) to the opposite so vector3.back will end up vector3.forward
                 if(Input.GetKeyDown("s")){
                 rigidbody.AddForce(Vector3.back*force);
                         if(Input.GetKeyDown("w")){
                                 rigidbody.AddForce(Vector3.forward*force);
                         }
                                 if(Input.GetKeyDown("a")){
                                         rigidbody.AddForce(Vector3.right*force);
                         }
                                         if(Input.GetKeyDown("d")){
                                                 rigidbody.AddForce(Vector3.left*force);
         }
                 }}}



if you want animations will have to add animation.play under the keystroke for animations, ex.

  if(Input.GetKeyDown("s")){
   rigidbody.AddForce(Vector3.back*force);
         animation.Play("snowmobileforward");

Or if you want the wheel of the snowmobile to rotate add

 public gameobject Wheel1;
 public gameobject Wheel2;
 public gameobject Wheel3;

to the declaration of the script &

 if(Input.GetKeyDown("s")){
                 rigidbody.AddForce(Vector3.back*force);
                 Wheel1.transform.Rotate(Vector3.Forward * Time.deltaTime);
                 Wheel2.transform.Rotate(Vector3.Forward * Time.deltaTime);
                 Wheel3.transform.Rotate(Vector3.Forward * Time.deltaTime);
             }
Comment
Add comment · Show 3 · 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 crusherxman · Dec 15, 2013 at 04:51 PM 0
Share

Umm... $$anonymous$$y snowmobile isn't moving at all, except when I press the "S" key, it only shakes and won't move.

avatar image jabez · Dec 17, 2013 at 04:13 AM 0
Share

adjust the force on the script to like 2000 just too see if it works, also check there's no colliders blocking it, you may have to change Vector3.back to like Vector3.up, depends what rotation your model is on. make sure there's a rigid body connected to it tou.

avatar image jabez · Dec 17, 2013 at 04:18 AM 0
Share

try this i forget too add a {

using UnityEngine; using System.Collections;

public class Snow$$anonymous$$obileController : $$anonymous$$onoBehaviour { public float force = 20;

 void Update () {
     // You may have to change rigidbody.AddForce(Vector3.back*force) to the opposite so vector3.back will end up vector3.forward
     if(Input.Get$$anonymous$$eyDown("s")){
         rigidbody.AddForce(Vector3.back*force);
     }
         if(Input.Get$$anonymous$$eyDown("w")){
             rigidbody.AddForce(Vector3.forward*force);
         }
         if(Input.Get$$anonymous$$eyDown("a")){
             rigidbody.AddForce(Vector3.right*force);
         }
         if(Input.Get$$anonymous$$eyDown("d")){
             rigidbody.AddForce(Vector3.left*force);
         }
     }}

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

18 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

Related Questions

The name 'Joystick' does not denote a valid type ('not found') 2 Answers

MMD How to export model and animations to Unity as 3rd person controller? 2 Answers

problem with MirrorReflection 1 Answer

Character fall animation 1 Answer

Animation can't find my animations 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