SenL Posted June 5, 2022 Share Posted June 5, 2022 (edited) How does Transform:SetPosition work? (I mean what are the 3 numbers represent) I tried Transform:SetPosition(0, 2, 0) but the prefab moves closer to Player I tried Transform:SetPosition(0, -2, 0) but the prefab spawns on top of Player (kind of) I tried Transform:SetPosition(0, 0, 2) but the prefab is slightly off ... somewhere Thanks. Edit: I'm making a mod where a prefab should be on top of the Player at all time. However this prevents Player from planting (such as pinecone). Player would say "I can't do that". I changed it to SetPosition(0,0,3) and it works but it's "off" and not on top of the Player. See image. How do I fix this? Make it "invisible" or hover so not taking up ground space, allowing Player to plant pinecone, etc. Thanks. Edited June 5, 2022 by SenL Link to comment https://forums.kleientertainment.com/forums/topic/140703-how-does-transformsetposition-work/ Share on other sites More sharing options...
CarlZalph Posted June 5, 2022 Share Posted June 5, 2022 @SenL Parent the entity to the player entity for it to follow, and add the "NOBLOCK" tag to make it not obstruct building. When you set position to a child entity it's relative to the parent's position and rotation. I believe the X coordinate controls the child's position relative to the forward direction of the parent. So an offset of (X, 0, 0) would make it appear in front of the player X units. Z I believe is for left-right relative to the player's facing direction. Y is height. 3 Link to comment https://forums.kleientertainment.com/forums/topic/140703-how-does-transformsetposition-work/#findComment-1575326 Share on other sites More sharing options...
SenL Posted June 5, 2022 Author Share Posted June 5, 2022 Adding NOBLOCk tag works!! Thanks!! Link to comment https://forums.kleientertainment.com/forums/topic/140703-how-does-transformsetposition-work/#findComment-1575343 Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now