Jump to content

Recommended Posts

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.

DontStarve_CantPlant.png

Edited by SenL

@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.

  • Like 3

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...