- Home /
Question by
Blockheadbear · Apr 22, 2015 at 04:13 PM ·
c#javascriptmovementboost
Boost pad for character controller
I am trying to make a jump pad for my space game that will launch the character controller across to different asteroids. I have managed to create a boost pad that propels the controller forward and a jump pad that shoots the controller directly up but I want to combine them (BTW I am relatively new to coding and I am trying to switch from javascript to C# so preferably answer in C# however any help at all is great!) Thanks in advance!
Here is the code I have at the moment
#pragma strict
var strength : int = 10; // Strenght, how high will the jumppad make the player jump
var jumppadsound : AudioClip; // Sound played when a player uses the jump pad
// make sure to check the Is Trigger checkbox in the Box/mesh/whatever collider
function OnTriggerEnter(col : Collider){
// Make sure the "Player" tag is set on the player
if(col.CompareTag("Player")){
col.gameObject.GetComponent(CharacterMotor).SetVelocity(Vector3.forward * strength);
audio.PlayOneShot(jumppadsound);
}
}
@script RequireComponent(AudioSource);
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613193750im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Making a bubble level (not a game but work tool) 1 Answer
Multiple Cars not working 1 Answer
Player Jumps instead of moving forward 0 Answers
Simple way to make an object go up and down?(Y axis) 1 Answer
Networking Synchronize Problem. 0 Answers