View unanswered posts | View active topics It is currently Thu Dec 26, 2024 4:25 pm



Reply to topic  [ 5 posts ] 
 Problem changing the velocity/angle of a spawned emitter. 
Author Message
User avatar

Joined: Sat Nov 18, 2006 8:11 pm
Posts: 267
Reply with quote
Post Problem changing the velocity/angle of a spawned emitter.
So, my script spawns an emitter that flies across the map. I want it to spawn high at get fired to the left and downwards. So I put this code in

Code:
         SandP.Vel.X = -math.random(150) - 50;
         SandP.Vel.Y = -math.random(35) - 40;


The line "SandP.Vel.X = -math.random(150) - 50;" works just dandy, sending the emitter flying to the left at a nice speed. The line "SandP.Vel.Y = -math.random(35) - 40;" doesn't work so well. It made the partciels fly upwards instead of downwards. So, I changed it to "SandP.Vel.Y = -math.random(-35) - -40;" thinking that making them negative would cause the emitter to fly down. However, now the emitter never spawns at all. how can I get it to have a downward velocity?


Tue Jul 14, 2009 10:17 pm
Profile WWW
User avatar

Joined: Thu Mar 06, 2008 10:54 pm
Posts: 1360
Location: USA
Reply with quote
Post Re: Problem changing the velocity/angle of a spawned emitter.
Use this

Code:
SandP.Vel.Y = math.random(35) + 40;

Edit: Y is switched around in CC. negative y velocity is upward, positive y velocity is downward.


Tue Jul 14, 2009 10:21 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Problem changing the velocity/angle of a spawned emitter.
Man I lose count of how many times I've said this.

CC's whole entire coordinate system (all of it) is based on the fourth quadrant of a graph. The top left corner of a scene is the "origin" of that graph. You will never need negative scene coordinates.


Tue Jul 14, 2009 10:25 pm
Profile
User avatar

Joined: Tue Nov 06, 2007 6:58 am
Posts: 2054
Reply with quote
Post Re: Problem changing the velocity/angle of a spawned emitter.
Velocity is the vector in question, Grif.


Tue Jul 14, 2009 11:53 pm
Profile
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Problem changing the velocity/angle of a spawned emitter.
It's still the same system.


Wed Jul 15, 2009 2:29 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 5 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.042s | 13 Queries | GZIP : Off ]