The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Idea for calculating position/angle?
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#1
Idea for calculating position/angle?

Okay, so I have this one scene where the player can use an item from different angles in order to get a slightly different result, but I'd like to improve this detection. Right now it uses 8 areas, 4 facing each cardinal direction and 4 in between those. I named the areas with _n_, _ne_, _sw_ etc. I have a UseItem callback on all areas calling the same event, using StringContains on asEntity to detect which area it is, then execute slightly different code for the results. It all works just like I want it, but it CAN be a little inaccurate at times.

Spoiler below!
[Image: k1LS3P8.png]

To explain a bit further what is going on, you use this item from different angles to place the item at the angle you used it from. If you use the item on the _nw_ area, the item will spawn facing the north west. The area in the middle (inactive in the pic) is used to pick up the item again after placing it, by interacting with it. The area on top is just to block the player from using it on the area on the opposite side of the column, by touching the edge of that area. It works to prevent that, but it doesn't prevent using the item on the edge of the side areas.

Basically, if you're standing on the north side, I want the item to appear facing north, but if you use the item at the very edge, you might be able to hit the west or east areas instead, and thus the item will face that direction. I don't want that.

Sooooo, to my question (finally). Is there a better way to detect the players position in relation to an object? The GetEntitiesCollide script does not support Player.

If I can't get a hold of a better way than what I have then I'll just go with it, because it works fairly well, but not perfectly.

Any suggestions are very much appreciated <3

05-22-2014, 04:51 PM
Find


Messages In This Thread
Idea for calculating position/angle? - by Mudbill - 05-22-2014, 04:51 PM



Users browsing this thread: 1 Guest(s)