Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting the parent of a gameobject during a collision doesn't maintain position #63

Open
Fortune117 opened this issue Nov 15, 2023 · 0 comments

Comments

@Fortune117
Copy link
Contributor

right now I have some code on a thrown object so that this runs in OnCollisionStart

	protected override void OnThrowImpact( Collision collision )
	{
		if ( !collision.Other.GameObject.TryGetComponent<IDamageable>( out var damageable, true, true ) )
			return;

		PhysicsComponent.Enabled = false;
		ModelCollider.Enabled = false;
		GameObject.SetParent( damageable.GameObject );
	}

However, it acts like this:
throw.webm

If I comment out the SetParent it behaves much closer to as expected:
throw.webm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant