Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kerbals unaffected by BDAc products #109

Closed
SpannerMonkey opened this issue Nov 30, 2016 · 15 comments

Comments

Projects
None yet
6 participants
@SpannerMonkey
Copy link

commented Nov 30, 2016

AS above, i believe this is a knock on effect from the fix squad applied to kerbals in order for them to be safe around wheels .
https://www.youtube.com/watch?v=LAt2YL7wzbQ

@TangentFoxy

This comment has been minimized.

Copy link

commented Dec 1, 2016

@SpannerMonkey You broke your URL somehow... Seems you have [https://www.youtube.com/watch?v=LAt2YL7wzbQ](url) instead of just https://www.youtube.com/watch?v=LAt2YL7wzbQ which would automatically turn into a clickable URL. xD 👍.

@gomker gomker added the enhancement label Dec 3, 2016

@gomker

This comment has been minimized.

Copy link
Collaborator

commented Dec 3, 2016

We should be able to detect kerbal hit somehow as they are "special" vessels and modify the damage code to interact similar to how destructible buildings are handled.

@Designer225

This comment has been minimized.

Copy link

commented Aug 24, 2017

The Kerbals are still unaffected by BDAc (it appears that they went through the Kerbals dealing no damage!). I enabled debug lines, and the hit does not even register on the Kerbal.

I'm going to compile the mod to a branch with a debug line near where a raycast hit is being detected.

@Designer225

This comment has been minimized.

Copy link

commented Aug 26, 2017

I ran some tests, and it appears that Kerbals don't have any part-based colliders anymore.

I currently have some codes added for debugging. The code attempts to find a Kerbal in EVA when a bullet is fired.

When I ran the test, I managed to find Bob's part. However, when I check for the colliders, they do not exist. (If they exist, then each collider gets printed onto the debug console. Or should be.) Strangely, Kerbals do act as though they have colliders, so maybe they do have colliders, just hidden.

I did use GetPartColliders instead of the singular collider, so I will need to do more testing.

I'll fork from this project to continue testing it out.

EDIT: The updated code does not show Kerbals as having a collider, either. It might be helpful to add colliders to all loaded Kerbals that interact with and only with BDAc weaponry.

EDIT 2: I looked into some bits of code using JetBrains DotPeek decompiler. Maybe we could take advantage of those?

@SpannerMonkey

This comment has been minimized.

Copy link
Author

commented Aug 26, 2017

Hi re Kerbals and colliders, the Kerbals were completely rebuilt and had substantial changes in order to prevent poor interaction with wheel and ground colliders. Although i can't find the post/thread I recall some talk that the Kerbals now exist on a different layer than all other parts in the flight scene. Unity uses layers extensively for different things, a full list of all currently known KSP relevant tags and layers can be found Here.
I strongly suspect that if re adding colliders is possible then it's very likely to have some odd effects in game.
I also suspect that this is not the case however, as the fairly extensive testing I carried out at the time of bug discovery, leads me to believe it is indeed a layer problem. The item that leads me to this conclusion is the fact that it's ALL BDA products, not just projectile weapons that are ineffective .
I constructed excessively explosive devices, equally several thousand tonnes of TNT and despite standing right next to the detonation the Kerbals remain unharmed unless struck by a flying piece of debris. Which does suggest that the Kerbals are not affected by things happening on the layers that BDA interacts with.
I have a vested interest in resolving this problem as it has effectively mothballed the BDA FPS mod ( since the first five mins of 1.2) to which I'm, a major contributor.
If there's any assistance I can provide to anyone investigating this issue do get in touch.

@Designer225

This comment has been minimized.

Copy link

commented Aug 26, 2017

It would be great if we could find out the layer collision matrix settings from the compiled game. Given that Kerbals interact with parts, buildings, and planet surfaces, I wonder if setting the BDA layer to either of the four could fix the problem...

Of course, there is no telling what bugs could be unleashed by doing so.

EDIT: For PooledBullet, the layer is 15. I'm changing it to some numbers, at least temporarily, to see if collision is detected. NullReferenceExceptions are finally useful, this time around.

@Designer225

This comment has been minimized.

Copy link

commented Aug 27, 2017

After a bit of struggle, I finally got the bullets to detect Kerbals.

By struggle, I meant trying to change the layer to detect collisions, and then later messing with the bit mask. I added some code with the bit mask to 17 << 17, and this time PoolBullet reported going through Kerbals.

I have pushed the changes onto my fork, but I'll keep working at it.

EDIT: Also it turns out touching gameObject.layer does next to nothing.

@Designer225

This comment has been minimized.

Copy link

commented Aug 27, 2017

I have killed Bob with the Vulcan. It takes a bit after the only shot on him before he goes down though.
20170826174343_1

I'm going to test this several times with less powerful weapons, to make sure this isn't the result of loops.

EDIT: The fork is also updated. I'll probably have to change the damage multiplier though because Bob literately disappeared after a single shot from the Vulcan.

EDIT2: After changing the Vulcan to deal less damage, I got Bob to disappear in two shots. So it is not the result of loops. I'm also not changing the damage multiplier because a 20mm is a fairly large wound to deal with. Oh and I already forked from this repo so that I can leave the main project code clean.

@Designer225

This comment has been minimized.

Copy link

commented Aug 27, 2017

Okay, I got pretty much all of the weapon types working in terms of collision detection and damage dealing now.

There is one small issue: When controlling the Kerbal to be exploded, sometimes it does not due to some errors. (When not controlling, it does explode, but some errors are thrown.)

I have pushed the changes into my fork (https://github.com/Designer225/BDArmory) now, I will create a new pull request and a temporary release build some time later.

EDIT: It would be great if the fork can be further improved.

@SpannerMonkey

This comment has been minimized.

Copy link
Author

commented Aug 27, 2017

@Designer225 Hi I'll be giving your code a try with the custom Kerbals weapons, the pack was specifically designed to be used by Kerbals and has adjusted appropriate values. If it seems promising I'll make sure that the coding team take a good look at it.

@Designer225

This comment has been minimized.

Copy link

commented Aug 27, 2017

@SpannerMonkey Go ahead. I really wanted to use BD FPS, as well.

I haven't fixed the aiming reticles yet, but I'll do this when I come back.

@SpannerMonkey

This comment has been minimized.

Copy link
Author

commented Aug 27, 2017

Tested, I have some concerns that the branch you built from is not one of the active dev branches. I had some strange graphical anomalies that i've not seen for a long time.

That aside your fix does indeed allow BDA products to interact once again with Kerbals, all FPS tested worked fine, didn't have any problem with aiming reticles, but then only testing over 100 meters or so.

I did however notice some nasty interaction between Kerbals and wheels, for example , kerbals contacts wheel, kerbal explodes, or kerbal contacts wheel, vehicle is launched into orbit. This is a problem not currently affecting the stock game, and if it's re appearance is tied firmly to your changes than it's a bit of a stumbling block , I'd imagine that most Kerbal combat would (once again) be accompanied by wheels and tracked vehicles( given that Kerbals can't walk around on ships etc unless landed and perfectly still.) and having to avoid contact with wheels etc on pain of death, would annoy users pretty quickly

@Designer225

This comment has been minimized.

Copy link

commented Aug 27, 2017

@SpannerMonkey

  1. Yeah I didn't build them from the dev branch. I'll pull files from that branch some time later. Merged the branches. Will test them. Tested them. They worked as normal.

  2. I was looking at ModuleWeapon, and I found parts of code that may be related to aiming reticles. I think without changes the projectile prediction path will predict a landing location past the Kerbal..

  3. My Kerbals don't even collide with stock wheels even with my code added, and that was also true in the base game. The only mods I had besides BDArmory is USI Warp Drive, Module Manager, and Physics Range Extender. To help with the problem though, which version of KSP, and what mods, are you using?
    EDIT: The wheels and tracks of Kerbal Foundries do do funky things you described when colliding with Kerbals, but that happens in almost stock (no mods except KF and KSPW) game as well.
    EDIT 2: Given that BDArmory now requires Physics Range Extender, all of the above could have been side effects of extending physics range. Of course, that is unlikely.

@jrodrigv jrodrigv added this to the v0.4 milestone Sep 26, 2017

@jrodrigv

This comment has been minimized.

Copy link
Collaborator

commented Sep 26, 2017

I have added this issue to the next milestone. PR merge still pending

@TheDogKSP TheDogKSP self-assigned this Oct 29, 2017

@TheDogKSP

This comment has been minimized.

Copy link
Collaborator

commented Nov 4, 2017

v1.0.0 released, closing this issue

@TheDogKSP TheDogKSP closed this Nov 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.