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 /
This question was closed Jun 02, 2013 at 07:16 AM by Fattie for the following reason:

Problem is not reproducible or outdated -- OP is asking a new nice questions

avatar image
0
Question by WarLordYT · May 18, 2013 at 05:22 AM · javascriptmovementtransform.positionmouselookparkour

transform.position over time? & mouselook rotate player?

I am trying to make parkour in my game, I have made raycasts and everything to make it work. But I have run into a few problems. Firstly, how do I make transform.position move over time? And secondly, how do I make the Mouselook rotate the player? Because the move direction is dependent on the rotation of the Z co-ordinate on the player variable?

(UnityScript for Parkour & C# for MouseLook (Unity's prefab mouselook))

Parkour Script

 var Player : GameObject;
 var Arms : GameObject;
 var SkyTrigger : GameObject;
 var HeadTrigger : GameObject;
 var WaistTrigger : GameObject;
 
 var VaultHeight : float = 1;
 var VaultLength : float = 2;
 
 var ClimbHeight : float = 2;
 var ClimbLength : float = 0.5;
 
 private var SkyBoole : boolean = false;
 private var HeadBoole : boolean = false;
 private var WaistBoole : boolean = false;
 
 private var ClimbEnabled : boolean = true;
 private var VaultEnabled : boolean = true;
 
 
 
 function Start()
 {
     Arms.animation.wrapMode = WrapMode.Loop;
     Arms.animation.Play("Idle");
 }
 
 function Update()
 {
     var SkyRay : RaycastHit;
     var HeadRay : RaycastHit;
     var WaistRay : RaycastHit;
     
     if(Physics.Raycast(SkyTrigger.transform.position, SkyTrigger.transform.forward, SkyRay, 1))
     {
         SkyBoole = true;
     }
     
     if(Physics.Raycast(HeadTrigger.transform.position, HeadTrigger.transform.forward, HeadRay, 0.25))
     {
         HeadBoole = true;
     }
     
     if(Physics.Raycast(WaistTrigger.transform.position, WaistTrigger.transform.forward, WaistRay, 0.25))
     {
         WaistBoole = true;
     }
     
     
     
     if(VaultEnabled)
     {
         if(WaistBoole && !HeadBoole)
         {
             ClimbEnabled = false;
             VaultEnabled = false;
             WaistBoole = false;
             HeadBoole = false;
             SkyBoole = false;
             Vault();
         }
     }
     
     
     if(ClimbEnabled)
     {
         if(WaistBoole && HeadBoole && !SkyBoole)
         {
             ClimbEnabled = false;
             VaultEnabled = false;
             WaistBoole = false;
             HeadBoole = false;
             SkyBoole = false;
             Climb();
         }
     }
     
     
     
 }
 
 function Vault()
 {
     Arms.animation.wrapMode = WrapMode.Once;
     ClimbEnabled = false;
     VaultEnabled = false;
     Arms.animation.CrossFade("Vault");
     yield WaitForSeconds (0.5);
     Player.transform.position.y=transform.position.y+VaultHeight;
     Player.transform.localPosition.z=transform.localPosition.z+VaultLength;
     yield WaitForSeconds (1);
     Arms.animation.CrossFade("Idle");
     Arms.animation.wrapMode = WrapMode.Loop;
     ClimbEnabled = true;
     VaultEnabled = true;
     WaistBoole = false;
     HeadBoole = false;
     SkyBoole = false;
 }
 
 function Climb()
 {
     Arms.animation.wrapMode = WrapMode.Once;
     ClimbEnabled = false;
     VaultEnabled = false;
     Arms.animation.CrossFade("Climb");
     yield WaitForSeconds (1.35);
     Player.transform.position.y=transform.position.y+ClimbHeight;
     Player.transform.localPosition.z=transform.localPosition.z+ClimbLength;
     yield WaitForSeconds (1);
     Arms.animation.CrossFade("Idle");
     Arms.animation.wrapMode = WrapMode.Loop;
     ClimbEnabled = true;
     VaultEnabled = true;
     WaistBoole = false;
     HeadBoole = false;
     SkyBoole = false;
 }

And MouseLook is Unity's Default Prefab

Comment
Add comment · Show 7
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 ExTheSea · May 18, 2013 at 07:45 PM 0
Share

Is your player a rigidbody, has a character controller or none of them both?

Also if the $$anonymous$$ouseLook Script really is just the standard script you can remove it from your question. $$anonymous$$akes it easier to read.

avatar image WarLordYT · May 19, 2013 at 03:19 AM 0
Share

$$anonymous$$y character has a Character Controller on it. & thanks for responding :)

avatar image ExTheSea · May 19, 2013 at 10:02 AM 0
Share

Then you can use CharacterController.$$anonymous$$ove ( http://docs.unity3d.com/Documentation/ScriptReference/CharacterController.$$anonymous$$ove.html )

avatar image WarLordYT · May 20, 2013 at 07:48 AM 0
Share

Thanks, But how do i make it move up first with this mechanic?

avatar image WarLordYT · May 20, 2013 at 08:04 AM 0
Share

And how do I make it move a specific distance in the forward direction, ins$$anonymous$$d of the way it works right now?

Show more comments

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

15 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

Related Questions

Vector3 of moving object always returns (0,0,0) 1 Answer

How can i Limit the Mouse X Axis for Mouse Look 3 Answers

Make so the script only moves and makes actions to the gameObject that its attached to. 2 Answers

Changing water level 0 Answers

Remove Force from Moving Object 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