Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I am struggling to figure out how to calculate the heading for a projectile, i.e. in .shoot or setArrowHeading, between two entities.

For example, if I have entities A and B, and I want a projectile to fire from A to B but want to ignore the facing, I had thought it would have been simple enough to do ...

x = target.getX() - firer.getX()

... for x, y and z. This seems to fire it in weird and wonderful directions.

After much Googling, it is still not clear to me what I should be passing into shoot for pX, pY and pZ.

Any tips or suggestions would be really appreciated. 

Edited by Scytale

if the idea requires mathematical knowledge that you do not have (working with angles) and programming skills you do not have (skipping math and finding a way to reuse existing projectile logic), why are you still working on this mod? surely you can come up with a mod idea without impassable barriers.

  • Author
20 minutes ago, MFMods said:

if the idea requires mathematical knowledge that you do not have ...

My experience to date, in this forum, has been some wonderful friendly people who were willing to help and provide some kind assistance.

  • 2 weeks later...
  • Author

Aside from the passive aggressive response, there was a tip buried there ... mathematical knowledge.

For closure ...

The heading between two entities is a rotation around the x and y axis - x for horizonal rotation and y for vertical. Thus simple trigonometry is used to calculate the angle of rotation between the x,y coordinates of the two entities.

  • Scytale changed the title to [Solved] [1.19] Heading between two objects

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.