Please help, I am completely stuck! What I want to happen is that I fire a lazer (particle) at a wall and, you know how the lazer would bounce off the wall, instead I want it to be a 3D object like a cube. So the lazer turns into a Cube or other shapes once it hits the wall.
Here are the key scripts:
I’ve got a Simple Character Controller-Main Camera-launcher
the launcher is a null in front of the camera with the script: guns
var bluelazer : GameObject;
function Update () {
if (Input.GetAxis(“Fire1”)){
Instantiate(bluelazer,transform.position,transform.rotation);
}
}
The blue lazer is a simple blue firing Particle lazer. The Particle has a script on it called: portallazer
var oneshot : boolean;
function OnParticleCollision (other : GameObject) {
if (oneshot==false){
oneshot=true;
other.SendMessage(“newportal”);
}
}
Good, now I have a wall which has a script: portalwall
var hasportal : boolean;
var portalblue : GameObject;
function newportal () {
if (hasportal==false){
theportal=Instantiate(portalblue,transform.position,transform.rotation);
theportal.transform.eulerAngles.x=-90;
theportal.transform.position.x=theportal.transform.position.x+1;
//theportal.transform.eulerAngles.y=270;
}
}
The Portalblue is set as a Cube.
When I shoot a wall, it spurts out all the cubes flying everywhere. I want a cube to rebound the wall like it would for the particle.
Feel free to try this. Sorry if it adds any pressure.