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 changing the way the third person camera works (with base edits) for a project. I've made it so that the camera only rotates in third person when middle mouse is down so the mouse is ungrabbed. I also unbound the player rotation from the camera rotation. My problem now is getting the block that the mouse is hovering over. I've overridden the getLook function in EntityPlayer but can't get anywhere from there. Heres the code in the base getLook function:

            float f1;
            float f2;
            float f3;
            float f4;

            if (par1 == 1.0F)
            {
                f1 = MathHelper.cos(-this.rotationYaw * 0.017453292F - (float)Math.PI);
                f2 = MathHelper.sin(-this.rotationYaw * 0.017453292F - (float)Math.PI);
                f3 = -MathHelper.cos(-this.rotationPitch * 0.017453292F);
                f4 = MathHelper.sin(-this.rotationPitch * 0.017453292F);
                return this.worldObj.getWorldVec3Pool().getVecFromPool((double)(f2 * f3), (double)f4, (double)(f1 * f3));
            }
            else
            {
                f1 = this.prevRotationPitch + (this.rotationPitch - this.prevRotationPitch) * par1;
                f2 = this.prevRotationYaw + (this.rotationYaw - this.prevRotationYaw) * par1;
                f3 = MathHelper.cos(-f2 * 0.017453292F - (float)Math.PI);
                f4 = MathHelper.sin(-f2 * 0.017453292F - (float)Math.PI);
                float f5 = -MathHelper.cos(-f1 * 0.017453292F);
                float f6 = MathHelper.sin(-f1 * 0.017453292F);
                return this.worldObj.getWorldVec3Pool().getVecFromPool((double)(f4 * f5), (double)f6, (double)(f3 * f5));
            }

 

I... Well I have no idea what to do here... Any help would be appreciated! Thanks. 

 

EDIT: I know the basics of what to do but have no idea how to implement it. If anyone has done anything similar to this then please help me out :)

Well if you could get the vectors you could use Ray traycing?

If you guys dont get it.. then well ya.. try harder...

  • Author

That would work but I have no idea where to start... And also would that work really? I want to check which block the mouse is hovering over in the custom view and have the black box and allow for right click, left click, etc. while ray tracing seems to be more for things like reflections.

yes it will work, its true that raytraycing is more popular when used with reflection/refraction/shadow/lighting but thats in the context of graphic rendering. in game programming ray traycing is used a lot to see if the trajectory of 2 object will interact (in your case blocks and your vision)

how to debug 101:http://www.minecraftforge.net/wiki/Debug_101

-hydroflame, author of the forge revolution-

  • Author

I have no idea where to start... Any ideas?

 

EDIT: Researched ray tracing a bit and I get how it works... kinda... Well anyways does anyone know the simplest way, or even any way, to do the ray tracing like does anyone have the algorithm that fits this purpose?

Check the World.clip methods mate ;)

If you guys dont get it.. then well ya.. try harder...

Oh a question for you is, are you familiar with Vectors?

If not, this would be the time to look into that part of math ;)

If you guys dont get it.. then well ya.. try harder...

  • Author

I know the basics of vectors: They are pretty much x, y, z either representing a location on a 3D grid or the movement of an object over a 3D grid. Checking out the clip methods.

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.