{"action":"created","issue":{"url":"https://api.github.com/repos/urho3d/Urho3D/issues/2264","repository_url":"https://api.github.com/repos/urho3d/Urho3D","labels_url":"https://api.github.com/repos/urho3d/Urho3D/issues/2264/labels{/name}","comments_url":"https://api.github.com/repos/urho3d/Urho3D/issues/2264/comments","events_url":"https://api.github.com/repos/urho3d/Urho3D/issues/2264/events","html_url":"https://github.com/urho3d/Urho3D/issues/2264","id":298863996,"number":2264,"title":"relativeConstantForce in ParticleEmitter is incorrect","user":{"login":"Lumak","id":14249868,"avatar_url":"https://avatars0.githubusercontent.com/u/14249868?v=4","gravatar_id":"","url":"https://api.github.com/users/Lumak","html_url":"https://github.com/Lumak","followers_url":"https://api.github.com/users/Lumak/followers","following_url":"https://api.github.com/users/Lumak/following{/other_user}","gists_url":"https://api.github.com/users/Lumak/gists{/gist_id}","starred_url":"https://api.github.com/users/Lumak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lumak/subscriptions","organizations_url":"https://api.github.com/users/Lumak/orgs","repos_url":"https://api.github.com/users/Lumak/repos","events_url":"https://api.github.com/users/Lumak/events{/privacy}","received_events_url":"https://api.github.com/users/Lumak/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-02-21T07:16:19Z","updated_at":"2018-02-21T22:51:27Z","closed_at":"2018-02-21T19:24:39Z","author_association":"CONTRIBUTOR","body":"The relativeConstantForce computation is unnecessary and redundant in ParticleEmitter, and the block, https://github.com/urho3d/Urho3D/blob/master/Source/Urho3D/Graphics/ParticleEmitter.cpp#L193-L200\r\n\r\nShould be:\r\n```\r\n            const Vector3& constantForce = effect_->GetConstantForce();\r\n            if (constantForce != Vector3::ZERO)\r\n            {\r\n                    particle.velocity_ += lastTimeStep_ * constantForce;\r\n            }\r\n```\r\nthe constantForce should be defined outside/before the for loop.\r\n\r\nRedundancy comes in because BillboardSet sets transform[0] to WorldMatrix, https://github.com/urho3d/Urho3D/blob/master/Source/Urho3D/Graphics/BillboardSet.cpp#L219\r\nAnd currently the position is ultimately the result of Rotation().Inverse() * worldMatrix multiplication. Just multiplying by constantForce  works correctly.\r\n\r\nHow to reproduce:\r\nUse this setup in the particle editor, rotate the node around Y-axis, and you should see the particles always traverse in relative neg Z-axis with the fix :\r\n```\r\n<particleeffect>\r\n\t<material name=\"Materials/Smoke.xml\" />\r\n\t<numparticles value=\"6\" />\r\n\t<updateinvisible enable=\"false\" />\r\n\t<relative enable=\"true\" />\r\n\t<scaled enable=\"false\" />\r\n\t<sorted enable=\"true\" />\r\n\t<animlodbias value=\"0\" />\r\n\t<emittertype value=\"Sphere\" />\r\n\t<emittersize value=\"0 0 0\" />\r\n\t<direction min=\"-0.1 0.8 -0.1\" max=\"0.1 1.1 0.1\" />\r\n\t<constantforce value=\"0 -10 -10\" />\r\n\t<dampingforce value=\"0.1\" />\r\n\t<activetime value=\"2\" />\r\n\t<inactivetime value=\"0\" />\r\n\t<emissionrate min=\"116\" max=\"116\" />\r\n\t<particlesize min=\"0.01 0.01\" max=\"0.1 0.1\" />\r\n\t<timetolive min=\"2\" max=\"2\" />\r\n\t<velocity min=\"5.2\" max=\"5.7\" />\r\n\t<rotation min=\"0\" max=\"0\" />\r\n\t<rotationspeed min=\"-10\" max=\"10\" />\r\n\t<colorfade color=\"1 1 1 0.9\" time=\"0\" />\r\n\t<colorfade color=\"1 1 1 0\" time=\"2\" />\r\n</particleeffect>\r\n\r\n```\r\nYou might have to change the **activetime value=\"0\"**, as I found this while prototyping and didn't really use the particle editor.\r\n\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/urho3d/Urho3D/issues/comments/367504808","html_url":"https://github.com/urho3d/Urho3D/issues/2264#issuecomment-367504808","issue_url":"https://api.github.com/repos/urho3d/Urho3D/issues/2264","id":367504808,"user":{"login":"Lumak","id":14249868,"avatar_url":"https://avatars0.githubusercontent.com/u/14249868?v=4","gravatar_id":"","url":"https://api.github.com/users/Lumak","html_url":"https://github.com/Lumak","followers_url":"https://api.github.com/users/Lumak/followers","following_url":"https://api.github.com/users/Lumak/following{/other_user}","gists_url":"https://api.github.com/users/Lumak/gists{/gist_id}","starred_url":"https://api.github.com/users/Lumak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lumak/subscriptions","organizations_url":"https://api.github.com/users/Lumak/orgs","repos_url":"https://api.github.com/users/Lumak/repos","events_url":"https://api.github.com/users/Lumak/events{/privacy}","received_events_url":"https://api.github.com/users/Lumak/received_events","type":"User","site_admin":false},"created_at":"2018-02-21T22:51:27Z","updated_at":"2018-02-21T22:51:27Z","author_association":"CONTRIBUTOR","body":"I see. I will submit a PR, just not gonna happen any time soon. I typically don't move from a release tag when making a game, so I'm on 1.7. PR would require sync'ing and testing on the head, and that is something I'm not willing to do until I finish what I'm working on."}}
{"actor":{"display_login":"Lumak"}}