+2
Answered

Shooter Module First Person

Crispy 3 months ago in Shooter updated 2 months ago 8

Currently it doesn't work with FPS arms because it expects a humanoid model.

Please make it work with FPS arms. I don't think it'll be hard. The Weapon and Ammunition objects just need to be more generic. Also, under 3D Model where you insert a gun to be attached to the hand, that isn't necessary, because the 3D Model should be parented to the Main Camera.


The following free asset is really good as it has everything from animations to sounds. It has 2 weapons, so you can set up draw and holster weapons, which I'm having trouble with. I've seen a developer use it in a tutorial video as well, so maybe you can make a video and kill two birds with one stone :) https://assetstore.unity.com/packages/3d/props/weapons/low-poly-fps-pack-free-sample-144839


For the Weapon object, I think it'll be useful to add a "On Aim" and "On Ease" action list like what you have in the Ammunition object.

Unity version:
Game Creator version:
1.0.4

Answer

Answer
Searching answer

You are mixing two complete systems. Game Creator requires a certain set up and the example that comes with the package you mention is set up differently. How Game Creator camera works is by copying the Player's position and rotation and transferring that data to the main camera. So, the idea is that the Character/Player moves around the scene, and it's the camera that follows up.

For the hands to point to where the camera looks at, we have created a forward kinematic algorithm that procedurally bends the spine and shoulders of the character. Your 3D model should be a humanoid in order for Game Creator to read each spine bone and apply the correct rotation.

If you want to use a non-humanoid character, you can still do, but you'll have to get creative. You can hide the Player/Character model and use the other package's set up (parenting the 3D model under the camera) but you are not getting access to the Muzzle Component, which is required in order for the Shooter module to know where the tip of the gun is and its direction.

Using a non-humanoid character that requires up/down movement is not doable at the moment. I'm opening a ticket, but it's not something that can be easily changed.

In Discord you told me arms should be a model of the Character when using the FP Motor, but: https://streamable.com/790ip Arms have to be parented to Camera or it will not work. I've checked tutorials and that's how they do it as well. Please actually try doing this yourself, to better understand it.

Answer
Searching answer

You are mixing two complete systems. Game Creator requires a certain set up and the example that comes with the package you mention is set up differently. How Game Creator camera works is by copying the Player's position and rotation and transferring that data to the main camera. So, the idea is that the Character/Player moves around the scene, and it's the camera that follows up.

For the hands to point to where the camera looks at, we have created a forward kinematic algorithm that procedurally bends the spine and shoulders of the character. Your 3D model should be a humanoid in order for Game Creator to read each spine bone and apply the correct rotation.

If you want to use a non-humanoid character, you can still do, but you'll have to get creative. You can hide the Player/Character model and use the other package's set up (parenting the 3D model under the camera) but you are not getting access to the Muzzle Component, which is required in order for the Shooter module to know where the tip of the gun is and its direction.

Using a non-humanoid character that requires up/down movement is not doable at the moment. I'm opening a ticket, but it's not something that can be easily changed.

Solution:

1) After dragging in the 3D Model, move the child of Player to be child of your camera.
2) The prefab with the Muzzle Component should just be an empty gameobject. This is what you insert under 3D Model in the Weapon object.
3) In order for the Muzzle to move with your gun, you have to parent it to your gun at runtime. You can't put something like "On Start" -> "Parent to gun", because it can't reference scene objects when it hasn't been instantiated. But what you can do is "On Start" -> "Store gameobject as Global Variable". Then this image should explain the rest:

The error still exists, but I think you can just add an option to turn off the procedural animations.

The latest Shooter module should fix this issue. Once you try it, please let me know if the error still pops or not.

Error is gone.

However, my method above doesn't actually work: https://streamable.com/0r12r
The Muzzle does not follow the animation of the Player (I used Character Model Action to change arms, then parented Muzzle to the arms). I think the Muzzle and the arms have to be one instance. So what I think we need is the ability to change the Player Model to a prefab that contains both the animator and Muzzle.

Answered

That is currently not possible. We're opening a ticket for a future version but we're not going to implement this since it would mean redesigning a great deal of the Shooter module.

Circling back to this issue. I've added as an experimental feature the ability to attach the weapon to the Camera, not to a Character bone. This will allow you to display the gun and hands as a child of the camera, which will inherit the rotation.

You'll be able to change this under the Weapon asset and at the 3D Model section, bone attachment -> Camera. After the update we can discuss if there are any incompatibilities with the rest of the system

This doesn't change much, since I was already parenting the weapon to the Camera quite easily with the Transform Action. Nonetheless, I appreciate the fact that you're working on this.

I would like to clarify my problem to make it easier for you: The arms and gun are animated by an animator. So they have to be in the same instance. They also need to be the Player model, in order to use States and Gestures. The Muzzle also has to be of the same instance, or it won't follow the animation of the gun. But the problem is that the Muzzle must be instantiated. It cannot exist in the same instance as the Player.

A solution for now is to have the arms, gun, and Muzzle all be a prefab and be instantiated by the Draw Action. Then, as you told me, use a custom animator on the Muzzle to animate the whole instance. But this is very cumbersome and hacky I feel. I have experimented with it and come to the conclusion that it requires way too much effort to make things feel half decent.