Howdy, Stranger!

It looks like you're new here. Sign in or register to get started.


Dark Dreams of Furiae - a new module for NWN:EE! Buy now
Attention, new and old users! Please read the new rules of conduct for the forums, and we hope you enjoy your stay!

Problem with GetObjectVisualTransform

I started messing around with this new function and ran into a problem (or maybe me just not using it right) right away. In testing I set down a placeable object (TEST_TRANSFORMER). And then used a control panel with, what I thought would be a simple script, to simply move the object on x axis. Here's the script on the control panel:
void main() { object oPC = GetLastUsedBy(); object oTransformer = GetObjectByTag("TEST_TRANSFORMER"); //int iUseable = GetUseableFlag(oTransformer); //SendMessageToPC(oPC, "Is Useable: " + IntToString(iUseable)); if (GetIsObjectValid(oTransformer)) SetObjectVisualTransform(oTransformer, OBJECT_VISUAL_TRANSFORM_TRANSLATE_X, 5.0); else SendMessageToPC(oPC, "Object not found"); }

So it works fine but only once. You use the control panel and the test object moves. When you use the control panel again the test object won't move. In addition when you go to click on the test object that just moved, your character will go to the original location of the test object, instead of where it is currently located, and try to use it. Am I just not using the function right or is this still a known bug? I did put in a little bit of debug stuff just to make sure the object still existed.


  • NeverwinterWightsNeverwinterWights Member Posts: 259
    Ok I think I get it now. This does keep moving it:
    void main() { object oPC = GetLastUsedBy(); object oTransformer = GetObjectByTag("TEST_TRANSFORMER"); float fCurrentTransform = GetObjectVisualTransform(oTransformer, OBJECT_VISUAL_TRANSFORM_TRANSLATE_X); if (GetIsObjectValid(oTransformer)) SetObjectVisualTransform(oTransformer, OBJECT_VISUAL_TRANSFORM_TRANSLATE_X, fCurrentTransform + 5.0); else SendMessageToPC(oPC, "Object not found"); }

    It's just odd that once you move something you can't "use" it correctly anymore, at least not at it's new position. I guess the object isn't "really" there. Just a copy of the object?

  • FreshLemonBunFreshLemonBun Member Posts: 907
    I'm not sure what you mean by a copy of the object but from my understanding a translation is an offset on a particular axis, using the coordinates as the origin, rather than a coordinate change. I think one of the Beamdog folks should clarify just to be sure.

    If you remove the visual transform I think the object will return to the original position.

    So if you want to increase the offset you'll need to calculate the new offset like you did in the second post, otherwise the offset remains the same, relative to it's position.

  • NeverwinterWightsNeverwinterWights Member Posts: 259
    edited May 2018
    I guess I'm just not sure what the "translation" is exactly. Is it only a visual representation of the actual object? A projection? Like I said if you use the function to "move" a useable object and then try to use that object, your PC will use the object at it's original location even though it's not there anymore(at least not visually). If that is the way the translation is supposed to work or not I don't know.

  • FreshLemonBunFreshLemonBun Member Posts: 907
    For example in math, translating a function or a vector displaces it. The function says it's a visual transform so it's probably only the visual portion that's affected.

  • NeverwinterWightsNeverwinterWights Member Posts: 259
    Hmm. So I suppose for the most part this will be used for things players can't interact with. Stuff just for show. I was thinking/hoping this would be a replacement for the old way of moving objects by destroying/creating them. Such as moving a bookshelf to reveal a secret door. Problem with this method is the bookshelf is still there and in your way.
    So not a problem with the function. Just what I was imagining it to be.

  • ProlericProleric Member Posts: 876
    That's right. The function only changes the appearance, not the walkmesh, use nodes etc.

    To create the bookcase secret door, for example, you'd need a bookcase placeable with no walkmesh for the visual part, and invisible barriers in the doorway and at the "open" position of the bookcase, toggled by script for the walkmesh part. Easily done.

    For creatures, there are similar limitations. The good news is that even part-based creatures scale nicely, hold weapons and perform combat animations correctly. The (not very) bad news is that pspace (which controls clipping) doesn't scale, and some node-related activity such as turning in conversation doesn't take account of rotation. All these things can be tweaked or suppressed.

    The only really strange thing I found with creatures is the animation speed. When the creature is walking or fighting, its body parts are no longer joined up (try it for fun!). I doubt whether this is a bug, just a limitation.

  • FreshLemonBunFreshLemonBun Member Posts: 907
    I'm not entirely sure but you might be able to make a bridge that has a trigger where the player is translated up the Z axis and set to no hitbox to simulate multi-level walkmeshes.

  • JFKJFK Member Posts: 213
    For 'moving' things, I'd suggest that after the transforms are complete, you could then destroy/create at the 'new location', and everything would be hunky-dory for player interaction. For the bookcase doorway, have the original bookcase placed sideways so it's 'open', and then apply the transformation to make it appear to be flat against the wall. Have an invisible object that prevents anyone from crossing through. When the bookcase is clicked or otherwise played with and you want it to open, destroy the invisible blocker and remove the transform so the bookcase reverts to its original position (sideways).


Sign In or Register to comment.