wiremod / wire

Garry's Mod add-on that allows users to wire up components in order to make more elaborate automatic and user-controlled contraptions.
http://www.wiremod.com
Apache License 2.0
551 stars 331 forks source link

Use setPos/setAng directly on the entity instead of phys #3026

Closed wrefgtzweve closed 4 months ago

wrefgtzweve commented 4 months ago

This pr makes it so E2 setPos and setAng are called on entities instead of their physics objects. Also fixes some linting issues in the file.

Example of previous weird behaviour:

local P = vec( random(1,100), random(1,100),random(1,100))
entity():setPos( P )
print( entity():pos(), "|", P )

image New behaviour: image

The same applies for setAng:

local P = ang(vec( random(1,100), random(1,100),random(1,100)))
entity():setAng( P )
print( entity():angles(), "|", P )

Previous: image New: image

This also makes setPos and setAng no longer weirdly lerped and actually makes them properly snap in place. Before the PR:

https://github.com/wiremod/wire/assets/69946827/6991fbbc-432b-440a-816f-d678539980a1

After:

https://github.com/wiremod/wire/assets/69946827/8dc61641-7d57-472f-b7c3-f548ca656ca7

wrefgtzweve commented 4 months ago

If needed i can fix the linting errors in the file

Denneisk commented 4 months ago

If you want that's fine.