Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Charles_Gams · Apr 10, 2013 at 09:59 AM · enemychildparenting

How to Grab an Object or Enemy

I know that to achieve a grab and choke system like in dishonored animation is involved . But thats not what i'm trying to get at. Ideally i want to know how to actually have a grab and choke system where your player grabs an enemy and you hold down a button for a certain amount of time until hes dead or lost his breath.

Here are my thoughts of what that system or code would require without animations:

  • Perhaps when my player is close enough to the enemy so having a variable to check distance between player and enemy .

    • Once thats checked at a certain distance where you are able to grab the enemy then the grab feature is available to use.

Here is where i just brainstorm ideas:

  • when the grab button is pressed eg// button a . The enemy's transform position equals the players transform position. So if i'm not mistaken the enemy becomes a child or parent of the player .

    • Whilst this is true disable all of the enemy's characteristics and enable a struggling characteristic which is only true when the player is grabbing the enemy.

    • Then to make sure the choke is successful you have to hold down the button A for example for a certain amount time. So time being used as a variable

    • After the choke is successful the enemy basically dies and a ragdoll of it instantiates

    • Or involving animations play the lost breath animation for a certain amount of time which is just the enemy just collapsed on the floor and make that Clamp forever.

    • To take it a step further you can drag the enemy around to hide him only if the above is true. Meaning the dragging of the enemy around function only activates then.

Ideally i know its something about transform positions and parenting childing but i'm not the greatest when it comes to coding things involving positioning especially when i want to position something the way i want. Also i was thinking it would involve a Get component feature meaning when i pressed the grab button and thats successful send a value or i think true to a function in the enemy class which is waiting to receive a value and once it has receivec that value then you disable the characteristics and enable the struggling one.

Any Guildlines or Help would be appreciated and it doesn't have to involve animation its just the functioning of the grab and choke system I'm concerned about. Thanks !!

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Charles_Gams · Apr 10, 2013 at 07:54 PM 0
Share

No inputs ?

avatar image jiteshvm · Apr 10, 2013 at 08:13 PM 0
Share

One thing to be careful while parenting is that the when the enemy gets parented to the player, its local position might change. $$anonymous$$aybe, have an empty GameObject inside the Player and set its local position to (0,0,0) and then parent the enemy to this empty GameObject rather than the player directly.

avatar image jiteshvm · Apr 10, 2013 at 08:17 PM 0
Share

You could also try it without parenting it to the player. By manually updating the position of the enemy based on the position of the player and certain joints position.

avatar image Charles_Gams · Apr 10, 2013 at 09:55 PM 0
Share

Hmm yeah i understand what you mean about the empty gameobject maybe thats why i had issues before .

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I access the children of a Transform? 5 Answers

Issues Rotating an object 0 Answers

iTween Parenting oncomplete issue 2 Answers

Parenting tutorial 1 Answer

Parenting 2 Rigidbodies Is What I'm Trying To Do? 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges