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

Hello,

 

I am trying to make a custom modeled bock change direction when I place it, as well as make it shoot a laser I have no idea how to.

 

Thanks.

Well, it is just a simple matter of rotating the model itself instead of the block.

 

So for instance, if you're using an wavefront model you can just call

 

GL11.glrotatef(angle, xvector, yvector, zvector);

 

before you render your model.

Well, what are you using then? The hardcoded way(tesselator)?

 

Let me add some stuff since it seems that isn't the only place you are stuck.

 

You can get the way the player is facing with

 

int l = MathHelper.floor_double((double)(Player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;

 

int the onBlockPlacedBy method.

 

Then write that value to metadata.

 

In your renderclass just read the metadata again and rotate the object accordingly(e.g. 2 == 0°, 3 == 90°, 4 == 180° & 5 == 270° or something like that)

and between your GL11.glpushMatrix() and gl11.glPopMatrix you just place

 

GL11.rotatef(yourpreviouslycalculatedangle, 0.0, 1.0f, 0.0f);

 

and this should actually work with whatever type of model you use.

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.