So… im doing a game where you do this… double jump thing… but when you double jump, you leave a trail of energy in the air
i used particule sistem to create this trail of energy and turned into a prefab… then i made an object atached to the character called “spawnpoint” so with scripiting, i could summon the energy prefab to be atached into the spawn point… witch is folowing the character while he is in the air
Transform.parent can be used to attach an object to another.
You could also attach the particle system to the object and disable it, only activate it in script if you need it.
Why dont you attach the energy prefab to the character in the position that you want it when jumping (spewing in the right direction) and then call it to emit from script?
Create the prefab,
Attach it to the object at its feet (not to its’ feet, unless that’s what you want)
turn the emitter off
attach the emitter to a script in a variable:
var spawnpoint : Transform;
well… that is my problem… i dont know the code to do it so… i dont know how to attach an object to another at runtime by scripting, think you could post a code example?
i tried to do like that link, appels sent… but is not working
also… i think i got another idea… why dont i leave the particule effects attached to the foots of the player since the beggining, but deactivated… and when i doublejumps i turn the particule effects active ?
that spawnpoint.Emit() you posted is to enable the particule animation right?
Did u find a solution to your problem?
I think you can use transform.TransformPoint.
[COLOR=#000000][FONT=Times New Roman][COLOR=#222222][FONT=Verdana][COLOR=#006600]// You need to assign an object to this variable in the inspector[/COLOR][COLOR=#006600]
[/COLOR]var someObject : GameObject;
[COLOR=#006600]// Instantiate an object to the right of the current object[/COLOR][COLOR=#006600]
[/COLOR]thePosition = transform.TransformPoint(2, 0, 0);
Instantiate(someObject, thePosition);[/FONT][/COLOR][/FONT][/COLOR]
For more details how to use it just check out the StarTrooper tutorial on Unity’s website.
but i’ll definitly take a look at that example right now… you know… gather information since im still very nooby
man! i realy think i might use this later!
thanks
oh and appels! sorry i misundestand what you said before, now i got… attach the particle on the body, but leave the emit off… then turn it on by scripting… genious! i did that and it worked
and not only that i learned the code transform.render = true; this will make my life much easier, now im gonna attach a laser gun at the character hand and leave the render off, so it will be invisible… and i will place another model of the same laser gun in the floor… so when the character colides with the laser gun… it will be destroied, and at the same time, the render of the laser gun attached to the hand of the character will be turned ON, then it will give the impression he picked up the thing… cool huh?
check the link to another guys similar solution (I posted code there too)
The point of that code was to offer the solution for a single jump, where when you hold the button down, you are jumping. then if you let up off the jump button, and press it again, you get a double jump. you can use the code, or modify it, but add the two code lines below.
Another piece of code I wrote was a double jump implemented into the first person shooter.
// in the beginning
var spawnpoint : Transform;
// in the section with:
// if we are in the air, and haven't done the second jump, we can. but only once.
spawnpoint.Emit()
BigMisterB thanks alot about the double jump… but i got mine working cool right now… if i had this a couple of weeks ago i would be jumping to the celling of happines because i was getting frustrating at programing a good double jump
well i finaly got it to work, and now when the character double jumps, i do a rocket pack apearing on his back with that (GameObject.render.active = true , and then i make a bursting plasma coming out of the rocket pack with particle.GetComponent(“ParticleEmitter”).emit = true; … looks pretty neat, is a nice double jump (and it has an phisic explanation instead of just jumping again in midair where you usualy can get any impulse xD)
finally when the character meets the ground, the emiter goes false, and so does the rocket pack mesh render… aw man. soo cool
now… talking about your great fps sistem man!.. i’ll definitely use that! because im thinking in a new feature of my game that makes the character aim freely… if you ever played zelda or megaman legends you will get the spirit of my game… is a 3rd person game, but with some weapons you go into the first person view so you can aim precisely… like the crosbow and hookshot and stuff…