Quantcast
Channel: Questions in topic: "parenting"
Viewing all articles
Browse latest Browse all 302

Player position relative to rotating platform [gif included]

$
0
0
So Im working with a character that can jump to a platform that rotates around itself. The problem is, when he jumps to it he's left behind by the platform and just falls down. Im trying to make it so that his position updates relative to the platforms rotation. I've tried making the platform parent of the character as soon as he jumps on it. This makes my character stand on the moving platform without getting left behind but he starts vibrating and changing his scale like this: https://imgur.com/ZfsrQHZ Here is my code: void FixedUpdate() { preserveRotation(); } private void preserveRotation() { RaycastHit hit; if (Physics.Raycast(transform.position, Vector3.down, out hit, 1.5f)) { if (hit.transform.tag == "Rotating Platform") { transform.SetParent(hit.transform, true); } } else { transform.SetParent(null,true); } } anyone have any suggestions as to how to fix this? should I make an aproach other than trying to parent the character to the platform?

Viewing all articles
Browse latest Browse all 302

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>