Welcome Guest [Log In] [Register]
We hope you enjoy your visit.


You're currently viewing the Ultimate 3D Community as a guest. This means that you can only read posts, but can not create posts or topics by yourself. To be able to post you need to register. Then you can participate in the community active and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.

Join our community!

If you are already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Partical Modifiers.
Topic Started: Sep 15 2007, 10:49 AM (258 Views)
Linkin
Member Avatar
Forum God
[ *  *  *  *  *  * ]
I think I heard from Dr.Best a while ago on some post that it is possible to make (Particals) sparks bounce when they hit the floor or object.
I know its done with partical modifiersand have read the partical part in the help file but still dont understand how to apply it. Can somebody help me on this please?

Thx
-DS
Posted Image
Want something done in Photoshop, make a request Here

Formerly known as DS-Development.
Offline Profile Quote Post Goto Top
 
$pecter
Member Avatar
Elite Member
[ *  *  *  * ]
Create a modifier
Code:
 
SetModifierEffectedArea(
ModifierID,
SecondSphereRadius,
PositionX, PositionY, PositionZ,
RotationX, RotationY, RotationZ,
ScalingX, ScalingY, ScalingZ
)

then set how the particles should react

Code:
 
SetModifierVelocityChange(
ModifierID,
VelocityFactorX, VelocityFactorY, VelocityFactorZ,
VelocitySummandX, VelocitySummandY, VelocitySummandZ
)

So when the particles enter the area defined by the first script they will react as defined by the second script.
Offline Profile Quote Post Goto Top
 
Linkin
Member Avatar
Forum God
[ *  *  *  *  *  * ]
In what events should these be placed?
Posted Image
Want something done in Photoshop, make a request Here

Formerly known as DS-Development.
Offline Profile Quote Post Goto Top
 
Dr. Best
Member Avatar
Administrator
[ *  *  *  *  *  * ]
In the create event of the particle system, after the call to CreateParticleSystem(). Here's a piece of code from the tech demo, that has a bouncer for the ground. There are also two other bouncers, but if you want only a ground bouncer you don't need those.

Code:
 
CreateParticleSystem();
texture=41;
// One ball gets created per step
SetParticleCount(1,1,100);
// They have a lifetime of 1000, but the bouncers and the ground reduce it
SetParticleLifetime(1000,1000);
// Initially the particles have only a horizontal movement
SetParticleVelocity(0,90,3,0,180,6);
// The vertical movement results from the gravity
SetParticleAcceleration(90,0,1.2,90,0,1.2);
// The particles always have a size of 0.5
SetParticleSize(0.5,0.5,0.5,0.5);
// The particles are blue, violett or red
SetInitialParticleColor(255,55,55,255,55,55,255,255);
SetFinalParticleColor(255,55,55,255,55,55,255,255);

// The first two modifiers represent the spheric objects the particles
// bounce against, the third one represents the ground
particle_bouncer_1=AddModifier();
particle_bouncer_2=AddModifier();
particle_killer=AddModifier();

// The first bumper effects all particles that are in the upper spheric
// model (ball_bouncer)
SetModifierEffectedArea(particle_bouncer_1,0,bouncer_id_1.x,bouncer_id_1.y,bouncer_id_1.z,bouncer_id_1.rotx,bouncer_id_1.roty,bouncer_id_1.rotz,bouncer_id_1.scalx,bouncer_id_1.scaly,bouncer_id_1.scalz);
// The modifier accelerates the particles horizontally and reflects them
// vertically (with some friction)
SetModifierVelocityChange(particle_bouncer_1,1.2,1.2,-0.8,0,0,0);
// As a particle hits the bouncer it gets older. If it bounces ten
// times it dies.
SetModifierLifetimeChange(particle_bouncer_1,-100);

// Same as above
SetModifierEffectedArea(particle_bouncer_2,0,bouncer_id_2.x,bouncer_id_2.y,bouncer_id_2.z,bouncer_id_2.rotx,bouncer_id_2.roty,bouncer_id_2.rotz,bouncer_id_2.scalx,bouncer_id_2.scaly,bouncer_id_2.scalz);
SetModifierVelocityChange(particle_bouncer_2,1.2,1.2,-0.8,0,0,0);
SetModifierLifetimeChange(particle_bouncer_2,-100);

// The particle killer is a giant flat sphere. It behaves like a plane.
SetModifierEffectedArea(particle_killer,0,x,y,z-21,0,0,0,1234,1234,2);
// It reflects them vertically with strong friction
SetModifierVelocityChange(particle_killer,1,1,-0.7,0,0,0);
// Once particles have reached the ground they will die fastly
SetModifierLifetimeChange(particle_killer,-200);
Offline Profile Quote Post Goto Top
 
$pecter
Member Avatar
Elite Member
[ *  *  *  * ]
Sorry, forgot to post the create code. :P
Create the modifier in the create event with AddModifier(). This will return the id of the modifier.
eg. modId=AddModifier();
Use those other functions in the create event or whenever you want to change the attributes.

EDIT: Dr. Best beat me :P
Offline Profile Quote Post Goto Top
 
Linkin
Member Avatar
Forum God
[ *  *  *  *  *  * ]
Srry one more question, how do i link the partical modifer with the object i want it to collide with?
Posted Image
Want something done in Photoshop, make a request Here

Formerly known as DS-Development.
Offline Profile Quote Post Goto Top
 
$pecter
Member Avatar
Elite Member
[ *  *  *  * ]
You don't link with an object you link with an area in 3D space.
Use this code
Code:
 

SetModifierEffectedArea(
ModifierID,//id of the modifier
SecondSphereRadius,//IMPORTANT! This is the size of the sphere(area))
PositionX, PositionY, PositionZ,//IMPORTANT! Set these to your object x,y and z
RotationX, RotationY, RotationZ,
ScalingX, ScalingY, ScalingZ
)
Offline Profile Quote Post Goto Top
 
Linkin
Member Avatar
Forum God
[ *  *  *  *  *  * ]
:mellow: ....... Aaaa lol thats where ive been going wrong. Ive been trying to link it with a object.... :whistle:

O well thx Guys for the help ;)

-DS
Posted Image
Want something done in Photoshop, make a request Here

Formerly known as DS-Development.
Offline Profile Quote Post Goto Top
 
$pecter
Member Avatar
Elite Member
[ *  *  *  * ]
And to think I didn't know anything about them a 1/2 hour :whistle:
Offline Profile Quote Post Goto Top
 
« Previous Topic · Questions about Ultimate 3D · Next Topic »
Add Reply