0
\$\begingroup\$

I am developing a multi-platform game in Unity.

It works great on Android and also on WebGL (haven't yet checked iOS).

My problem is that in some of the levels I need to use mobile-specific actions like shake, tilt and multi-touch.

Is there any way to simulate this in a WebGL app?

Examples of what I need: Tilt to move an object without touching the object. The idea is to "sail" the object from the top of the screen into a basket at the bottom avoiding some obstacle on the way. Tilt to cause an object to move across the screen

Shake to cause something to break.

Multi-touch to select two objects at the same time.

\$\endgroup\$
  • \$\begingroup\$ What do you expect the PC player to do? Shake their keyboard?!? You will have to find some alternative input solution for devices with a mouse and a keyboard. But what solution would be adequate here depends on the game. Can you tell us more about what situations require that input? We might then be able to recommend an alternative solution. \$\endgroup\$ – Philipp Jul 27 at 14:01
  • \$\begingroup\$ @Philipp Added some examples. I know I can't expect a player to shake or tilt the PC or keyboard! Question is what is the best alternative. \$\endgroup\$ – theblitz Jul 27 at 14:11
0
\$\begingroup\$

Tilt to move an object without touching the object. The idea is to "sail" the object from the top of the screen into a basket at the bottom avoiding some obstacle on the way. Tilt to cause an object to move across the screen

What you could do here is use mouse dragging on the background to cause a rotation of the whole scene.

Shake to cause something to break.

Shake the mouse cursor. A good way to detect shaking is to check the difference between mouse positions per frame and count how many times per second the change on the x-axis or y-axis changes from positive to negative.

Multi-touch to select two objects at the same time.

Standard for multi-selection on PC is to use shift+leftclick or ctrl+leftclick to add an additional object to the current selection. But players might not expect that to be possible in your game, so you need to teach them. But then there is the problem that moving the selection will move it in formation. So it won't allow you to do things like moving two objects towards each other.

So depending on what you actually want the player to do, you might have to look for a different UI solution.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.