0
Answered

Custom Player Input - Input Type?

marjohloo 4 months ago in Game Creator updated by Marti (Lead Developer) 4 months ago 1

Is there any sensible way to add a custom Input Type in a modular fashion or am I best to just hack my new option directly into PlayerCharacter.cs?

Basically I want a minor change in UpdateInputDirectional() so the movement is relative to the rotation from the camera position to the player, rather than relative to the camera's rotation which would normally follow the player (but is a no-no in VR):


 Vector3 xrRelativePos = this.transform.position - maincam.transform.position; 
xrRelativePos.y = 0;

Vector3 moveDirection = (
Quaternion.Euler(0, maincam.transform.rotation.eulerAngles.y, 0) *
Quaternion.LookRotation(xrRelativePos, Vector3.up) *

this.direction
);

Unity version:
2019.3.14f1
Game Creator version:
1.1.8
Answered

You could try creating a class that inherits from PlayerCharacter and override the methods you want to change. I believe most of them are set as virtual.

Remember to place the new class outside the Plugins/ folder so it survives updates.