how do i get my player get sucked into a gameobject

I have a Rotating object that float back and forth in a platform game. I needed my player to jump in it and shoot his way to the next platform. I got the jump in half worked( I had help with that cause i’m still kind a new), but the only problem I have is when the player jump into the rotating Object, the player being swing around the rotating object instead of staying INside the object. This is the script i’m using

void OnTriggerEnter2D(Collider2D other)
{
	GameObject.FindGameObjectWithTag("Player").GetComponent<SpriteRenderer>().enabled = false;

	if (other.gameObject.CompareTag ("Player")) 
	{
		other.gameObject.transform.parent = transform;
	}
}

How do I make the player get sucked inside the floating rotating object and have the player just follows it without going crazy?

From reading your description, I think that the “swinging” you are referring to is due to the player object being offset when it becomes childed to the rotating object. If you’d like to have the object stick to the origin of the rotating object, you simply need to get rid of the local offset, by adjusting the localPosition of the player. It should look like such:

void OnTriggerEnter2D(Collider2d other)
{
     if(other.gameObject.CompareTag("Player"))
     {
          other.gameObject.GetComponent<SpriteRenderer>().enabled = false;
          other.gameObject.transform.parent = transform;
          other.gameObject.transform.localPosition = new Vector3(0f,0f,0f);
     }
}

Similarly, you can do the same with rotation, if you’d like to align the player.

@Ckboyd89
Aww… it didn’t work still…
my Playerobject is still being swung around like it got caught by a hurricane when it jumped into the Rotatingobject. I even tried turn off the rotation from the Rotatingobject and test it out, the Playerobject actually fall through it when it collides. This is what i’m using on the RotatingObject

public float amplitude;           
public float speed;                   
private float startPosition;
private Vector3 tempPos; 

void Start () 
{
	startPosition = transform.position.y;
	tempPos = transform.position;  
}

void Update ()
{
	tempPos.y = startPosition + amplitude * Mathf.Sin (speed * Time.time);
	transform.position = tempPos;
	transform.Rotate (0, 0, 300 * Time.deltaTime);
}

void OnTriggerEnter2D(Collider2D other)
{
	if (other.gameObject.CompareTag ("Player")) 
	{
		other.gameObject.transform.parent = transform;
		//other.gameObject.GetComponent<SpriteRenderer>().enabled = false;
		other.gameObject.transform.localPosition = new Vector3 (0f, 0f, 0f);
		other.gameObject.transform.localRotation = Quaternion.identity;

	}
}

}

The PlayerObject is the one with the tag “Player”.
So, is there a way maybe i can freeze the PlayerObject into the Rotatingobject? My player don’t really have to rotate or anything, just as long as the Playerobject look like it’s behind the Rotating object, it good. Sorry if i’m being complicated and my bad English