Problem with new weapon

Support for MFPS 2.0
Post Reply
User avatar
commonblob
Contributor
Contributor
Posts: 18
Joined: Fri Feb 05, 2021 1:26 pm

I created a new weapon for MFPS. Everything works fine except the aim toggle. When I aim, it does not move into the centre of the screen at runtime.
At design time it looks correct on the game view, but not runtime.

Looking at the bl_gun code I can see the local position is set according to the vector3, but doesn't move far enough.

Any ideas? The built in guns work ok
User avatar
commonblob
Contributor
Contributor
Posts: 18
Joined: Fri Feb 05, 2021 1:26 pm

Have updated code to 1.8 and still seeing the same behaviour.
User avatar
commonblob
Contributor
Contributor
Posts: 18
Joined: Fri Feb 05, 2021 1:26 pm

Ive resolved the problem.
For some reason the aimposition was showing in Unity correctly, but when i looked at the prefab in VSCode, the aimposition was incorrect.

Manually editing the .prefab file to correct the aimposition fixed this in game.

Im not sure if thats Unity, or your editor extension thats causing that issue. But ive resolved it anyway.
User avatar
commonblob
Contributor
Contributor
Posts: 18
Joined: Fri Feb 05, 2021 1:26 pm

So, it must be something else. I have done a number of weapons now and still having the problem. Also looked in the .prefab file to check the aimposition and its correct compared to the GUI, yet the gun still doesnt move to the correct position as it does in design time.

Have also stepped through bl_gun's operation checking the aimposition and Aim(). Aimposition value is consistant throughout with whats stored. Aim() code is setting the position correctly. So from what I am seeing, the value that is stored at design time is wrong.

At design time, this value works for my model as the center: 0,-0.085,0. But at runtime, it needs to be about -0.1, -0.05,-0.03
Would could be affecting this at runtime compared to design time?

I think my work around is to just run the game, get the values then and then put them in at design time, but my question to you is, is this supposed to work?
User avatar
Lovatto
Admin
Admin
Posts: 1755
Joined: Sun Dec 07, 2014 3:18 pm
Contact:

Hi,

For what you are describing I think the problem is with your weapon animation,
Maybe one or more of your animation (TakeIn or Fire animation) change the default weapon pose position,
you can check this by comparing the position of the weapon (where the Animation or Animator component is attached to) in edit and play mode,
if the position is different in runtime, then that is the issue.
How to find your Invoice Number: Here
How to find your Order Number: Here
User avatar
commonblob
Contributor
Contributor
Posts: 18
Joined: Fri Feb 05, 2021 1:26 pm

That is a very good point Lovatto, thanks. Will check that out.
User avatar
commonblob
Contributor
Contributor
Posts: 18
Joined: Fri Feb 05, 2021 1:26 pm

btw, got this sorted. Not 100% sure how, but i did, and everything working well now. It may have been due to the rewrite of the weapon animations that I did, but anyway, thanks
Post Reply