Jump to content
This site uses cookies! Learn More

This site uses cookies!

armedunity.com uses cookies to improve user experience.

By continuing to use this site, you agree to allow us to store cookies on your computer.

  • 0
fpsarmedunity

pickup and grab obejcts.. again

Question

Hi ,yes i know i made a similar threah some time ago and I have my pickup and grab script fully functional an working  but sincerly i'm not completely satisfied with it...since i have a little issue..

 

my grab script is based on standard fpskit 1.6 GrabObjects script but heavily modified..

 

the issue is related to the fact i need to left the box collider active even when object is picked up  to prefent it clipping with other object but when i left that active and try to set the adjust position to a value lower than 2.5 the grabbed obejct reamins stucked on player after picked up and player cannot leave it..

 

i was thinking this could be related to the physics interaction layer but tired to disable the interaction between the two interested layer ( pickup and playr) but issues remains..

i was thinking this could be caused from my modified scirpt so i tried with original GrabObjects script but when i left atvie the collider on obejct picjed up and lower the adjust position issue is there..

 

here the original fpskit 1.5 Grabobjects script

Please login or register to see this code.

and here a video of the issue

 

ehere a little video with the default fpskit grabobjects script and the modified

 

obj.GetComponent<Collider>().enabled = true;

 

 

 

Share this post


Link to post
Share on other sites

6 answers to this question

Recommended Posts


  • 0

another idea would be to disable the collider and enabling a trigegr object infront of the player that takes case of collisions or a boxcast 

Share this post


Link to post
Share on other sites
  • 0

What’s with the yield return null? Shouldnt you yield to end of frame? don’t think your code is being reached after the while statement if your returning unless I’m reading that wrong. Throw a debug after the while loop to make sure that part of the code is being reached

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

hi and thanks i tried with:

 

 Physics.IgnoreLayerCollision(9, 15);  // there are the affectd layers "Player" and "Pickup"
           

and with 

Physics.IgnoreCollision(obj.GetComponent<Collider>(), GetComponent<Collider>());

 

where "obj" is the generic carried Gameobject

 

but i dont know if i done correcly

 

btw thisis my complete GrabObjects scritp if could help

 

Please login or register to see this code.

 with no results

Share this post


Link to post
Share on other sites
  • 0
Please login or register to see this quote.

hi mate and thanks for your reply too but i cannot undrestood whha you mean.. can you elaborate please??

thanks in advance

Share this post


Link to post
Share on other sites
  • 0

nevermind ..solved by myself

 

 i simply changed this line

Please login or register to see this code.

into this

Please login or register to see this code.

 

this solved some really annoying bugs on items distance pickups since beforewhen player tried to pickup  really near objets since the "hlding distance " was too big  several times picked objects fall under floor when player tried to pickup them.. now this bug is gone.. ..I'm really happy...

 

thanks to all

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...