Jump to content

Transform:Point() Bug?


Phodex Games
 Share

Recommended Posts

I am not 100% sure if this is a bug, but the Transform:Point() function has a weird behavior for me. If it is my mistake then I am sorry and would also be glad if it can be sovled easily.

 

This is the code I have:

 

local direction = Transform:Point(0, 0, 10, self.entity:FindChild(0), nil)

 

I use it for an NPC, that he is able to pick objects in the world. But my code didnt work so I tried to find the problem. After placing a small box at the "direction" vector I found out that it isnt at the transformed point, other than this it remains at the entity it should be transformed to (the "self.entity:FindChild(0)").

 

After that I tired to make the "Transform" function work seperatly from my npc, for testing purpose. I created a pivot and an other pivot attached to the first one. The parent pivot has the following script:

 

function Script:Start()
local direction = Transform:Point(0, 0, 10, self.entity:GetChild(0), nil)
local model = Model:Box(0.05,0.05, 0.05)
model:SetPosition(direction)
end

 

The direction seems to be the same as the entitys position, no matter what Vector I set in the "Transform" function (for example: local direction = Transform:Point(964, 0, 66, self.entity:GetChild(0), nil)). It does not move, but if I put the exact same code, and pivots into another project it works??

 

And the raycasting of my player, which is in the same scene and project, works as well. However, I also tried it creating a new map in my project but doesnt seem to work. The player has the following code for the direction:

 

local direction = Transform:Point(0, 0, self.useDistance, self.entity:GetChild(0), nil)
--self.entity:GetChild(0) is the "player eye" a pivot infront of the player

 

Sorry if it is my fault, but I just dont know why it doesnt work, without reason???

 

EDIT:

After some more testing I found out that setting the Transform option to the following:

Transform:Point(Vec3(0, 0, 999999), self.entity:GetChild(0), nil)

just works. The local space of the object seems to be extemley "sensitive". But why is this?

 

EDIT2 (Solution):

After like hours of finding the error I found it -.- I was because my npc models scale was 0.001 and not 1.0, I didnt collapsed the model in the model editor. And the Eye pivots scale was 0.001 as well. I am not sure if this is a bug or not? But I guess the local position of an object should not change, depending of its scale or am I wrong???

  • Upvote 1
Link to comment
Share on other sites

  • 2 weeks later...

The local position will change based on scale. This is a good example of how explaining a problem to someone else can often cause you to figure out the solution. I do this all the time.

My job is to make tools you love, with the features you want, and performance you can't live without.

Link to comment
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...