[osg-users] particle speed in OSG Particle Effects

Trajce Nikolov NICK trajce.nikolov.nick at gmail.com
Sun Oct 25 13:11:56 PDT 2015


Jannik, you were right .. Here is the thing (bellow) .. Thanks a bunch for
the pointer !!

inline void RadialShooter::shoot(Particle* P) const
    {
        float theta = _theta_range.get_random();
        float phi = _phi_range.get_random();
        float speed = _speed_range.get_random();
        osg::Vec3 rot_speed = _rot_speed_range.get_random();

        P->setVelocity(osg::Vec3(
            speed * sinf(theta) * cosf(phi),
            speed * sinf(theta) * sinf(phi),
            speed * cosf(theta)
            ));

        P->setAngularVelocity(rot_speed);
    }

On Sun, Oct 25, 2015 at 7:37 PM, Trajce Nikolov NICK <
trajce.nikolov.nick at gmail.com> wrote:

> Wops, too fast .. Pressed wrong keys
>
> void osgParticle::ModularEmitter::emitParticles(double dt)
> ....
> Particle* P = getParticleSystem()->createParticle(getUseDefaultTemplate()?
> 0: &getParticleTemplate());
>             if (P)
>             {
>                 _placer->place(P);
>                 P->setPosition(P->getPosition() * worldToPs);
>                 _shooter->shoot(P);
>                 P->setVelocity(osg::Matrix::transform3x3(P->getVelocity(),
>                                                          worldToPs));
>
>                 if (cps)
> P->setUpTexCoordsAsPartOfConnectedParticleSystem(cps);
>             }
>
> On Sun, Oct 25, 2015 at 7:36 PM, Trajce Nikolov NICK <
> trajce.nikolov.nick at gmail.com> wrote:
>
>> Hi Jannik,
>>
>> thanks for the hint. Here is what I see in ModularEmitter:
>>
>>
>> On Sun, Oct 25, 2015 at 7:25 PM, Jannik Heller <scrawl at baseoftrash.de>
>> wrote:
>>
>>> Hi Nick,
>>>
>>> the particle template's velocity isn't used, it's the particle emitter
>>> that determines initial particle velocity. Have a look at the
>>> ModularEmitter / Shooter classes in osgParticle.
>>>
>>> If you wanted to globally make particles simulate faster (as in a time
>>> lapse) you could just change the osg simulationTime to run faster.
>>>
>>> ------------------
>>> Read this topic online here:
>>> http://forum.openscenegraph.org/viewtopic.php?p=65438#65438
>>>
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> osg-users mailing list
>>> osg-users at lists.openscenegraph.org
>>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>>
>>
>>
>>
>> --
>> trajce nikolov nick
>>
>
>
>
> --
> trajce nikolov nick
>



-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151025/fcc8f263/attachment-0003.htm>


More information about the osg-users mailing list