Idea for calculating position/angle? - Printable Version +- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum) +-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html) +--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html) +---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html) +---- Thread: Idea for calculating position/angle? (/thread-25345.html) Pages:
1
2
|
Idea for calculating position/angle? - Mudbill - 05-22-2014 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!
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 RE: Idea for calculating position/angle? - Daemian - 05-22-2014 Mmmh What if you set the areas active only when the player looks at them? So only the area he's looking at will accept the item. RE: Idea for calculating position/angle? - Mudbill - 05-23-2014 That still wouldn't make a difference, because if he looks at the edge, the game will assume he's standing on that side. I thought about something similar, but since you need to look at an area to use an item on it, all areas would be active anyway. But maybe if I change the size of them or something... RE: Idea for calculating position/angle? - Daemian - 05-23-2014 Yeap. What is all this coding for? You're working on something original? RE: Idea for calculating position/angle? - Mudbill - 05-23-2014 I guess you could say that. I have a little Youtube experimental series where I take ideas and try to implement them, though I have a certain line I want to follow. This exact situation is present in a puzzle I'm making involving guiding a beam of light using mirrors, lenses (for colors), splitters and other contraptions. The reason I need different angles is because the player should be able to place these objects differently, since each check point can have 4 different results based on angle of each object. Here's a video showing it more in action. Perhaps it can help explain the issue better. Skip to 6:00. [video=youtube]http://youtu.be/yc48CqOc-qU?t=6m[/video] RE: Idea for calculating position/angle? - DnALANGE - 05-23-2014 I saw the vid Mudbill... I gtg soon, so try to make this short.. - Istn it possible to make those area's around it. And try to make it like this? --- IF player is standing in area North -> disable all other area's on top of the pedestal. IF player goes OUT the area, turn all the area's on. SO standing in NORTH ( deactivate south west etc etc.. but leave NORTH as it is for adding the mirror there. Might work pritty good i guess.. ----- PHP Code: AddEntityCollideCallback("Player", "NORTH_Area", "ActivateNorthAndDeactivateothers", false, 0); PHP Code: void ActivateNorthAndDeactivateothers(string &in asParent, string &in asChild, int alState) The only annoying this is you need to make 8 of these scripts... BUT, you can sorta copy paste them and change some small area's. RE: Idea for calculating position/angle? - Mudbill - 05-23-2014 That's an idea. I first thought it was like what I had already tried, but I don't think I disabled other areas next to. It might work. Suppose I'll give it a try later. RE: Idea for calculating position/angle? - DnALANGE - 05-23-2014 (05-23-2014, 11:11 AM)Mudbill Wrote: That's an idea. I first thought it was like what I had already tried, but I don't think I disabled other areas next to. It might work. Suppose I'll give it a try later. Oki Mudbill. IF this isnt working ( i guess it should work great .. have it on premonition sorta the same ) Then we will find another solution for you. RE: Idea for calculating position/angle? - Daemian - 05-23-2014 I see. I would let the player turn the mirror himself. You place the mirror, then you start turning it by clicking on it. It could turn about 45° each time. RE: Idea for calculating position/angle? - Mudbill - 05-23-2014 I had that idea too, but how would I pick it back up? The player needs to be able to remove the mirror as well, and if clicking on it rotates it, I'd need something else for picking it up and I think that could be confusing. Edit: Alright, I'm re-writing the whole thing and I think I might be onto something that could work. I do have one question, almost off-topic. You miiight have noticed that I mentioned in the video that the other mirror item wasn't working due to its name. Does anyone know if AddUseItemCallback does NOT support the use of asterisk? Using "ItemMirror_*" in the item string does not work, but it doesn't say anything on the documentation that asterisk isn't supported. Oh, and I also have it inside a for-loop, and for some reason, using "ItemMirror_"+x did not work either, which is very odd to me. Well, it kinda works, but not quite. The item named ItemMirror_2 seemed to react, but _1 and _3 does not. |