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 Wesley21spelde · Jan 29 at 08:16 PM · aitargetingfeet

Ai Targetting feet instead of my body

hey guys my ai is still shooting at my feet i know my pivot is over thare but i cant change it becouse it would wrek my player prefab i tried it so i tried getting the ai to shoot 1unit above my feet i looked at https://docs.unity3d.com/ScriptReference/Vector3.html for reffrence but it is still not working i used vector3 up as i understand it it would be 0,1,0.... so 1unit up i guess but it is still targetting my feet

enyone an idea how to fix this

i tried

 transform.LookAt(target.transform.position += Vector3.up * Time.deltaTime);

..........................................................................

 transform.LookAt(target,Vector3.up);

.............................................................................

alt text

ai.png (485.8 kB)
Comment
Add comment
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

2 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by jaca6767 · Jan 29 at 10:59 PM

You could add an offset to the script which controls the turret. Just add a vector3.up * height offset to whatever line contains the angle it's determining.

Some code to demonstrate this:

    public Transform target;
    public float heightOffset;
    void Update()
    {
        transform.LookAt(target.position + (Vector3.up * heightOffset), Vector3.up);
    }

Good luck, I hope this works in your multiplayer.

Comment
Add comment · Show 4 · Share
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 Wesley21spelde · Jan 29 at 11:05 PM 0
Share

@jaca6767 can you plaese show me an example how to add the height? to the vector3.up * height

avatar image Wesley21spelde · Jan 30 at 10:28 AM 0
Share

@jaca6767 yeah thanks works fine. reallly thanks i am so happy it finaly works.. can i maybe ask you an other thing i dont know if you have knowlage of strea$$anonymous$$g with photon onserializeview but in i am having problems with strea$$anonymous$$g and mostly reveiving layerweigts for my animations so if you are willing to help me with this please let me know ill show you what the problem is i alreddy asked it here on UA and some one told me what i did wrong but didnt explain how i can fix it i did try to get my answer on my own by googeling but i could not find anything on strea$$anonymous$$g layer weights only layer weights them self so please let me know.... thanks :D

avatar image jaca6767 Wesley21spelde · Jan 30 at 01:33 PM 0
Share

@Wesley21spelde Sadly I have no experience with multi-player functionality. Could you mark this threads as solved?

avatar image Wesley21spelde jaca6767 · Jan 30 at 01:44 PM 0
Share

Thanks anyway :D i marked it as solved

avatar image
0

Answer by SlamaBilliken · Jan 29 at 08:51 PM

You could make an empty Gameobject as a child of your character and move it to wherever you want the enemy to shoot, then use that object that as the enemy's target rather than the character itself.

Comment
Add comment · Show 1 · Share
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 Wesley21spelde · Jan 29 at 09:03 PM 0
Share

hi yeah i forgot to mention i tried that but than i got problems with the network manager and other scripts becouse they couldnt find the player tag object anymore becouse it is a child thats why i wanted to try this.. anyw ay thanks for the tip ill try it again :D

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

214 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

C# Targetting Help 1 Answer

How to determine a "cone of influence" used for targeting an object. 2 Answers

What would be the best way to setup Target priority 1 Answer

AI Picking New Target After First Target Gets Destroyed 0 Answers

Hey I need an AI script for a character noticing nearby characters! 2 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