Hello.
I'm a beginner in game production. I'm using a translator, so some sentences may not be correct. Sorry.
Is it possible to create a system in which when the cursor is placed on the edge of the screen, the screen scrolls in the direction in which the cursor is placed?
For example, I have a transparent menu at both ends of the screen and imagine the character moving when the cursor is placed on the edge.(first person camera)
Then, when the cursor is shifted from the edge, the character stops moving.
I'd be glad to know a good way to make that happen.
Thank you.
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Welcome to the community, @WK_molimoli.
It can be done with a simple custom script.
I can assist with this, but I'll need to be clear: you mention use of the first person camera - are you looking to have the character physically move sideways, or just turn the camera, when moving the cursor to the screen's edge?
Thanks for the reply, Chris.
I want to physically move the character to the sideways.
Thanks for clarifying.
You can do this by overriding AC's input detection, and have it simulate left/right arrows keys based on the mouse position.
Copy/paste this code into a C# file named CursorStrafing and attach to a GameObject in the scene, or your Player prefab:
I tried it and it worked!
I am not a programmer but AC makes it very fun to create games.
Thank you so much!