Mesh Socket Rotation [SOLVED]

   164   3   0
User Avatar
Member
29 posts
Joined: Jan. 2016
Offline
I am attempting to set up multiple mesh sockets on some geometry for export into unreal engine.

I am using an attribute wrangle to create the points. I am trying to set the rot for the socket but when I try to load into unreal engine (as digital asset) it crashes unreal (hard crash).

If I comment out the add and set attrib for rot then it loads in unreal and all the sockets are created, but I need
to fix it so I can set the rotation of the socket as well.

Here is the vex I am using in the wrangle. Any ideas on what I am doing wrong?

void CreateSocket(string socketName; vector position; vector rotation)
{
    int handle = addpoint(geoself(), position);
    setpointgroup(geoself(), 'socket_room', handle, 1);
    setattrib(geoself(), 'point', 'unreal_mesh_socket_name', handle, 0, socketName);
    setattrib(geoself(), 'point', 'rot', handle, 0, rotation);
}

addattrib(geoself(), 'point', 'unreal_mesh_socket_name', '');
addattrib(geoself(), 'point', 'rot', {0,0,0});

CreateSocket('Floor_North_West', {2.5, 0, 2.5}, {1.0, 0, 0});
CreateSocket('Floor_North_East', {-2.5, 0, 2.5}, {-1.0, 0, 0});

Here is the relevant log info after the crash

LogFactory: FactoryCreateFile: HoudiniAsset with HoudiniAssetFactory (0 0 DUnrealProjects/modeus/Resources/Houdini/Themes/DungeonTheme/ungeon_theme_tile_floor_corridor_base.hdalc)
LogHoudiniEngineEditor: PostSpawnActor HoudiniAssetActor_0, supplied Asset = 0x0000026A687327F0
LogActorComponent: UnregisterComponent: (/Game/Maps/DungeonThemeTIles.DungeonThemeTIlesersistentLevel.ungeon_theme_tile_floor_corridor_base.StaticMeshComponent_1) Not registered. Aborting.
LogHoudiniEngineEditor: PostSpawnActor HoudiniAssetActor_1, supplied Asset = 0x0000026A687327F0
LogHoudiniEngine: HAPI Asynchronous Instantiation Started for HoudiniAssetActor_1: Asset=Object/dungeon_theme_tile_floor_corridor_base, HoudiniAsset = 0x687327f0
LogHoudiniEngine: ungeon_theme_tile_floor_corridor_base_2 FinishedInstantiation.
LogHoudiniEngine: HAPI Asynchronous Cooking Started for ungeon_theme_tile_floor_corridor_base_2., AssetId = 4
LogHoudiniEngine: ungeon_theme_tile_floor_corridor_base_2 FinishedCooking.
LogStaticMesh: Building static mesh S_DT_Floor_Base_Corridor_SIZE_4_5_0_0_rendered_collision_geo_584209E4…
LogStaticMesh: Built static mesh /Game/Maps/DungeonThemeTIles.DungeonThemeTIlesersistentLevel./Game/Houdini/ungeon_theme_tile_floor_corridor_base_F14159F24106/S_DT_Floor_Base_Corridor_SIZE_4_5_0_0_rendered_collision_geo_584209E4.S_DT_Floor_Base_Corridor_SIZE_4_5_0_0_rendered_collision_geo_584209E4
LogWindows: Windows GetLastError: The operation completed successfully. (0)

Thanks.
Edited by Aladin Sane - Dec. 28, 2017 01:05:57

Attachments:
vexsockets.PNG (346.5 KB)

User Avatar
Member
29 posts
Joined: Jan. 2016
Offline
ok made some progress.

I found the following in the crashlog

<ErrorMessage>Assertion failed: (Index &gt;= 0) &amp; (Index &lt; ArrayNum)
Array index out of bounds: 12 from an array of size 12
</ErrorMessage>

So I changed the vex to pass vector4 instead of vector and it sort of works. The last issue I have now is any value I put into the vector4 is translated to 180. I have tried 1, -1, 180, -90, 90, all get entered in unreal as 180. All of the zeros stay zero. I am going to search to see what I have to do to get correct rotation value (if anyone knows please let me know)

void CreateSocket(string socketName; vector position; vector4 rotation)
{
    int handle = addpoint(geoself(), position);
    setpointgroup(geoself(), 'socket_room', handle, 1);
    setattrib(geoself(), 'point', 'unreal_mesh_socket_name', handle, 0, socketName);
    setattrib(geoself(), 'point', 'rot', handle, 0, rotation);
}

addattrib(geoself(), 'point', 'unreal_mesh_socket_name', '');
addattrib(geoself(), 'point', 'rot', {0,0,0,0});

CreateSocket('Socket_One', {0.0, 0.0, 2.0}, {0, 90, 0, 0});
CreateSocket('Socket_Two', {0.0, 0.0, -2.0}, {0, 0, 0, 0});
CreateSocket('Socket_Three', {-2.0, 0.0, 0.0}, {0, -1, 0, 0});
CreateSocket('Socket_Four', {2.0, 0.0, 0.0}, {0, 1, 0, 0});
User Avatar
Member
29 posts
Joined: Jan. 2016
Offline
ok I have fixed it (I think)

I had to convert from euler to quaternion.

Here is how I did it.

void CreateSocket(string socketName; vector position; vector rotation)
{
    int handle = addpoint(geoself(), position);
    setpointgroup(geoself(), 'socket_room', handle, 1);
    setattrib(geoself(), 'point', 'unreal_mesh_socket_name', handle, 0, socketName);
    
    vector radians = radians(rotation);
    vector4 rotQuat = eulertoquaternion(radians, XFORM_XYZ);
    setattrib(geoself(), 'point', 'rot', handle, 0, rotQuat);
}

CreateSocket('Socket_One', {0.0, 0.0, 2.0}, {0, 180, 0});
CreateSocket('Socket_Two', {0.0, 0.0, -2.0}, {0, 0, 0});
CreateSocket('Socket_Three', {-2.0, 0.0, 0.0}, {0, -90, 0});
CreateSocket('Socket_Four', {2.0, 0.0, 0.0}, {0, 90, 0});
Edited by Aladin Sane - Dec. 28, 2017 00:46:35
User Avatar
Staff
122 posts
Joined: Sept. 2016
Online
Hi,

Sorry for the late reply, seems like you figured this out.
Rot is indeed expected to be a quaternion…

I have submitted a fix for the crash and I'll update the plug-in docs to mention this to avoid further confusion.
Edited by dpernuit - Jan. 2, 2018 10:53:53
  • Quick Links