Hello,
I am new to unity and am familiar with objective c but have no idea about javascript. I was wondering if anyone could tell me how to modify the FPS controls for iphone to make the right button shoot with two taps and the left button jump with two taps.
Thanks.
Hi, welcome to the forum!
The Joystick class (as used by the mobile device FPS controller) has a variable called tapCount that detects the number of taps. The FirstPersonControl.js script actually makes use of this, for example at line 95.
So how would i make it shoot a game object on a double tap.
Let me rephrase, How would i make a double tap from the right rotate joystick shoot a rigidbody from the position of the player.
Thanks.
How about "how would i make this script:
var projectile : Rigidbody;
var initialSpeed = 20.0;
var reloadTime = 0.5;
var ammoCount = 20;
private var lastShot = -10.0;
function Fire () {
// Did the time exceed the reload time?
if (Time.time > reloadTime + lastShot ammoCount > 0) {
// create a new projectile, use the same position and rotation as the Launcher.
var instantiatedProjectile : Rigidbody = Instantiate (projectile, transform.position, transform.rotation);
// Give it an initial forward velocity. The direction is along the z-axis of the missile launcher’s transform.
instantiatedProjectile.velocity = transform.TransformDirection(Vector3 (0, 0, initialSpeed));
// Ignore collisions between the missile and the character controller
Physics.IgnoreCollision(instantiatedProjectile.collider, transform.root.collider);
lastShot = Time.time;
ammoCount–;
}
}
respond to a tap on a button/joystick instead of a mouse click.
Ok nevermind about that button click because i have gotten that to work. What I now need help with is making the projectile fly from the FPS character and not from the middle of the screen.
Thanks if you can help.
Hello there buddies I am on the same track I have a setup and I also need a script to make my character shoot to other game objects and I also need another script which helps me to animate my character so any suggestions for it??? please post it I was following unity tutorials on unitylabs.net but unfortunately its on sale so cant get any better idea how to make it happen actually any help will be appreciated and thank u in advance!!!
You should really attempt to engineer this yourself. You’ll find progress is really slow asking for scripting handouts on the forums. Just open the script file and start writing it. there’s enough reference out there, and project examples to easily figure this out.