- Home /
Spawning a plane in front of an FPS player?
In my game, I am using sprites for first person weapons (there are a variety of reasons for this, chiefly that it is supposed to look old school.) To accomplish this, I simply have a plane texture mapped with the sprite positioned in front of the camera, as so:
if(Input.GetKey(KeyCode.Alpha1)) {
Destroy(currentWeapon);
currentWeapon = Instantiate(weaponInventory[1],transform.position +(transform.forward * 0.45), transform.rotation);
currentWeapon.transform.parent = transform;
currentWeapon.transform.position.y = 1.35;
}
However, I have a problem with this code - while the prefab is indeed spawned in front of the player, the rotation is not perpendicular with the players forward vector - only with the origins forward vector. I've fiddled with this code a thousand different ways to no effect - any sort of solution would be most welcomed.
Comment