OpenClonk Bugtracker - OpenClonk
View Issue Details
0001198OpenClonkEngine - C4Scriptpublic2014-12-30 16:182017-06-20 15:19
ReporterApfelclonk 
Assigned ToZapper 
PrioritynormalSeverityfeatureReproducibilityhave not tried
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version7.0 
Target Version7.2Fixed in Version 
Summary0001198: Radial distribution for CreateParticles()
DescriptionThere is no way to create particles, which spread out radially, with CreateParticles()-parameters or PV_*s only. With the old particle-system you could easily do CastParticles().

Zapper mentioned one way to fix this would be set a fixed seed in PV_Random(). That way you could use the same returned array of PV_Random() for both parameters:

var rnd = PV_Random(0, 360);

CreateParticles([...], PV_Sin(rnd, p_speed), PV_Sin(rnd, p_speed, 90[?]),[...]);
Additional InformationA workaround until there is a consistent way:

for(var i = 0; i < p_amount; i++)
{
 var angle = Random(360);
 CreateParticles([...], Sin(angle, p_speed), -Cos(angle, p_speed), [...]);
}
TagsNo tags attached.
Attached Files

Notes
(0003299)
Zapper   
2014-12-30 23:11   
(Last edited: 2014-12-30 23:12)
>Zapper mentioned one way to fix this would be set a fixed seed in PV_Random(). That way you could use the same returned array of PV_Random() for both parameters:

I was talking about some sort of seed-parameter for PV_Random (which then is particle-dependant). Then you could use the same random number for two values in a particle.

CreateParticles(..., PV_Cos(PV_Random(..,SEED1), PV_Random(..,SEED2)), PV_Sin(PV_Random(..,SEED1), PV_Random(..,SEED2)), ...)
.. which would make both Cos and Sin have the same radius and angle because of the same particle-local seed

(0003300)
Apfelclonk   
2014-12-31 10:22   
Ah. then I missunderstood you. But that sounds to be an even nicer solution to implement afterwards, I guess.
(0003673)
Maikel   
2015-06-16 22:15   
Is this then resolved?
(0003677)
Apfelclonk   
2015-06-17 14:28   
(Last edited: 2015-06-17 14:29)
As long as nobody fixed this without updating this bug entry, no.
I only missunderstood Zapper in the way he proposed to fix this. The problem is still alive.

(0003678)
Maikel   
2015-06-17 21:55   
Ah, I see, PV_Random does not have a seed.

Then we need a seed for that :)
(0005004)
occ   
2016-02-27 12:40   
Hi! There's been a check-in that references this bug. For more information you can visit the repository browser at this address:
https://git.openclonk.org/openclonk.git/commitdiff/3d71dfbfa9f83358ca4c2f9cc7cf3a3003f43f43

Changeset 3d71dfb by David Dormagen <czapper@gmx.de>
Particles: added a "seed" parameter to PV_Random (0001198)

(0005005)
Zapper   
2016-02-27 12:41   
This is implemented via a seed for PV_Random now.

See the docs for an example:
http://docs.openclonk.org/en/sdk/script/fn/PV_Random.html

Issue History
2014-12-30 16:18ApfelclonkNew Issue
2014-12-30 23:11ZapperNote Added: 0003299
2014-12-30 23:12ZapperNote Edited: 0003299bug_revision_view_page.php?bugnote_id=3299#r717
2014-12-31 10:22ApfelclonkNote Added: 0003300
2015-06-16 22:15MaikelNote Added: 0003673
2015-06-16 22:15MaikelStatusnew => feedback
2015-06-17 14:28ApfelclonkNote Added: 0003677
2015-06-17 14:28ApfelclonkStatusfeedback => new
2015-06-17 14:29ApfelclonkNote Edited: 0003677bug_revision_view_page.php?bugnote_id=3677#r879
2015-06-17 21:55MaikelNote Added: 0003678
2016-01-27 15:34MaikelProduct Version => 7.0
2016-01-27 15:34MaikelTarget Version => 7.2
2016-01-27 15:34MaikelSummaryRadial destribution for CreateParticles() => Radial distribution for CreateParticles()
2016-01-27 15:34MaikelAssigned To => Zapper
2016-01-27 15:34MaikelStatusnew => assigned
2016-01-29 17:27ZapperStatusassigned => new
2016-01-29 17:29ZapperAssigned ToZapper =>
2016-02-27 12:40occNote Added: 0005004
2016-02-27 12:41ZapperNote Added: 0005005
2016-02-27 12:41ZapperStatusnew => resolved
2016-02-27 12:41ZapperResolutionopen => fixed
2016-02-27 12:41ZapperAssigned To => Zapper