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.

Is there a way to initialise a TESR model with parameters?

Featured Replies

Posted

I'd like to make a TESR with a model which can be varied depending on the TESR's state when the model is constructed. Not things like animation which change over time, but the actual model parts and boxes. Obviously I could just make multiple possible TE classes with their own corresponding TESRs, but I'd like to be able to create the variations in the code rather than manually. The trouble is, the TESR doesn't have a normal constructor (the sort of place where I could access a TE parameter and customise the model accordingly). The best thing I can think of is to store something like an 'isInitalised' boolean and then, on the first tick where it's not initialised, construct the model based on the TE parameter in renderTileEntityAt. But this seems kind of hacky and like it might cause other problems. I can't find any kind of initialisation method in the TESR, but I'm hopeful that I might be missing something. Or if I'm not, then does my above idea seem plausible, or terrible?

 

For context, I'm working on falling trees. My current plan is to create an invisible TE when the tree is cut. This TE will check and store the size and shape of the tree, then the TESR's model would be based on that information, and be animated as if falling. So there are countless possible variations in tree shape, and I'd like to be able to make the model procedurally rather than manually - but once the model is made it doesn't change.

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.