MouseShoots.cs acting strange
by Ben Hamlett · in Torque Game Builder · 07/14/2012 (5:58 am) · 3 replies
Heya, I am using the "MouseShoots.cs" behaviour in my game and for some reason when I add it to an object (turret) that has been mounted to another object, it only fires when I click on the object (turret) instead of when I click.
There is no errors in the console so I cant figure out why this is happening :S any ideas?
There is no errors in the console so I cant figure out why this is happening :S any ideas?
About the author
#2
I'm assuming what you want is to fire anywhere on the scene that you click? If so, you could try a couple of things.
1) Use the setMouseLocked(true) command on your turret so that it gets all mouse events.
2) Somehow get mouse callbacks from the scene itself and use them to send calls to your turret to shoot. There may be a way to receive empty background clicks. But if you have a backdrop image, you can set that scene object to accept mouse clicks.
07/16/2012 (11:22 am)
I'm a little lost but it sounds like you copied some shooting code and made it work for mouse down on an object. And that's what you are getting now.I'm assuming what you want is to fire anywhere on the scene that you click? If so, you could try a couple of things.
1) Use the setMouseLocked(true) command on your turret so that it gets all mouse events.
2) Somehow get mouse callbacks from the scene itself and use them to send calls to your turret to shoot. There may be a way to receive empty background clicks. But if you have a backdrop image, you can set that scene object to accept mouse clicks.
#3
I actually got this to work by applying Face Mouse behaviour to both the turret and the object it was mounted too :) cheers.
07/16/2012 (1:05 pm)
Hey Charlie, thanks for the reply.I actually got this to work by applying Face Mouse behaviour to both the turret and the object it was mounted too :) cheers.
Ben Hamlett
GameDon
If I add a behaviour for the "joint" to face the mouse and then mount he Turret to the Joint and give the Turret a behaviour of MouseDownFire then it will only fire if I click on the actual scene object "Turret".
Any ideas how I could fix this issue?