Mouse Controlled Gun - Help Needed!
3 posts • Page 1 of 1
Mouse Controlled Gun - Help Needed!
Building a mouse controlled gun turret, but I have a big problem. Every time the laser hits the box to spawn the bullet, its collideset and colour are changed! This means that the laser no longer hits the box and makes bullets.
I have no idea how to fix this, does anyone else have this problem or can help?
[scene]45636[/scene]
E to fire.
I have no idea how to fix this, does anyone else have this problem or can help?
[scene]45636[/scene]
E to fire.
-

Dare - Posts: 833
- Joined: Sat Nov 21, 2009 4:27 pm
- Location: Sydney, Australia
Re: Mouse Controlled Gun - Help Needed!
Easy fix.
You made the mistake of writing = instead of := in the spawn code.
= Mean to change an existing variable
:= Means to create a variable
scene.addbox({
pos = e.pos;
size = [0.2, 0.07];
color = [1.0, 0.9, 0.0, 1.0];
collideset = 8;
drawborder = true;
restitution = 0.5;
friction = 0.0;
vel := (e.normal * (20))
})
Algodoo reads the highlighted text as "change collideset to 8", since the only collideset variable the laser sees is the laser's it will try and change that one instead.
scene.addbox({
pos := e.pos;
size := [0.2, 0.07];
color := [1.0, 0.9, 0.0, 1.0];
collideset := 8;
drawborder := true;
restitution := 0.5;
friction := 0.0;
vel := (e.normal * (20))
})
Now algodoo will read the highlighted text as "create collideset that equal 8"
Also with the laser change maxrays to 1, and i recommend making the bullets either change rotation to fit the angle of the shot or to simply be circle. Good luck.
You made the mistake of writing = instead of := in the spawn code.
= Mean to change an existing variable
:= Means to create a variable
scene.addbox({
pos = e.pos;
size = [0.2, 0.07];
color = [1.0, 0.9, 0.0, 1.0];
collideset = 8;
drawborder = true;
restitution = 0.5;
friction = 0.0;
vel := (e.normal * (20))
})
Algodoo reads the highlighted text as "change collideset to 8", since the only collideset variable the laser sees is the laser's it will try and change that one instead.
scene.addbox({
pos := e.pos;
size := [0.2, 0.07];
color := [1.0, 0.9, 0.0, 1.0];
collideset := 8;
drawborder := true;
restitution := 0.5;
friction := 0.0;
vel := (e.normal * (20))
})
Now algodoo will read the highlighted text as "create collideset that equal 8"
Also with the laser change maxrays to 1, and i recommend making the bullets either change rotation to fit the angle of the shot or to simply be circle. Good luck.
-

Mystery - Posts: 2802
- Joined: Thu Sep 03, 2009 1:16 pm
- Location: Southern Australia
Re: Mouse Controlled Gun - Help Needed!
Cool, thanks a lot!
-

Dare - Posts: 833
- Joined: Sat Nov 21, 2009 4:27 pm
- Location: Sydney, Australia
3 posts • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 5 guests




