Player Transform Postion on Collision Javascript/C#
So I have this Skimboarding game where you run onto a Skimboard(Like a skateboard for water) and it goes from a animated walking 3rd person controlled player to a Unanimated for now Prefab with a Player with the board attached.
I have everything I want roughly working from questions on here but unfortunately I need to mix some things from a Javascript to a simple C# and as a beginner having a trouble grasping whats happening.
Right now I can Manually switch the animated walking player to the Board riding prefab with this Javascript
// Bring Prefab Board rider to Animated Walking Player
if (Input.GetKey("y"))
{
var player = GameObject.Find("Ragdoll");
transform.position = player.transform.position;
}
// Move Animated Walking player away
if (Input.GetKey("r"))
{
var player2 = GameObject.Find("Ragdoll");
player2.transform.position = Vector3(-400,0,27);
}
And id like to do both those things at once when I collide with the Skimboard in the C# Collision script I already have( Parenting it to the Player on contact) Board tagged as Wall for now
public class NewBehaviourScript : MonoBehaviour {
private void OnCollisionEnter(Collision other)
{
if(other.gameObject.tag == "Wall") {
other.transform.parent = transform;
transform.position = other.transform.position;
}
}
I tried a couple things but it seems to break a lot of unrelated scripts saying im mixing mac and windows code. Thanks for any pointers