addrelative force doesnt work in 2017.2 anymore
it all happens in world space
is this a bug?
addrelative force doesnt work in 2017.2 anymore
it all happens in world space
is this a bug?
found that its only happening on instantiated gameobjects
still havent found a way to fix it
Maybe you’re using the wrong forcemode, or maybe instantiated objects are considered inactive on the frame they are created, and AddRelativeForce cannot come into play. Could we see your script?
It’s working fine for me (2017.2.0f3).
Check your prefab settings, and throw together a simple test scene to isolate the problem.
it worked fine in 2017.1 and unity5
heres the code
IEnumerator ejectshell(float waitTime)
{
yield return new WaitForSeconds(waitTime);
GameObject shellInstance;
shellInstance = Instantiate(shell, shellPos.transform.position,shellPos.transform.rotation) as GameObject;
shellInstance.GetComponent<Rigidbody>().AddRelativeForce(60,70,0);
shellInstance.GetComponent<Rigidbody>().AddRelativeTorque(500,20,800);
}
if i add force in a script directly on the instantiated prefab it works fine
i just dont want to modify all my code
If the is same project/functionality works fine in 2017.1, but stops working in 2017.2, then you most likely found a regression.
Unity Technologies made various changes to the Physics System in 2017.2 and most likely their tests don’t cover your use-case.
Therefore I recommend to submit a bug-report following the advice in this document.
Using the bug-reporter seems to be an important step, because it makes sure the report is in Unity Technologies bug-tracking pipeline and has to be processed at some point. Using the forum is often used to add to a little more attention to a bug-report, but does not replace submitting the bug-report.
It’s from advantage to attach a project to the bug-report that UT can use to reproduce the issue and test their fix against. The easier an issue can be reproduced by QA, the more likely it is to get forwarded to a developer, who might or might not work on a bug-fix for that at some point.
After you submitted the bug-report, you receive a confirmation email with a Case number. UT often asks us to post the Case number in the forum thread, which allows them to find that bug-report if they look at your post.
Following these steps will increase the chance that UT is looking at your issue tremendously.
ill submit a bug report
just wanted to know if it was a bug or it was just me doing something wrong
ill add the force directly in the prefabs script for now as a workaround
Yield return WaitForEndOfFrame, or null to wait a single frame after instantiating the shell prefab and before adding the force, to see if that might fix the issue. It seems like it might be a bug, but the single (or partial) frame wait probably isn’t important enough to go out of your way and bother writing the eject functionality into the prefab instead.
oooh adding waitforendofframe before addforce actually fixed it, tnx!
Please still submit a bug-report to Unity, so they can actually fix the issue.
allready done
im lost
that didnt fix it for everytime, still happens occasionally
Did you try just yielding null so it waits until the next frame?
how do i yield null? dont find it in the scripting ref
edit
nevermind found it, will try that
yield return null;
yes that fixed it
tnx
unity replied to the bug report and it basicly says im doing it wrong in my scripts.
so why did it work before then?
im not submitting bug reports anymore, what a waste of time
tnx for the help here tho
How did they say you should be doing it?