Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hankster112

Pages: 1 2
1
Ask a Question / Re: Raycasting Help
« on: January 30, 2021, 09:32:54 am »
It has something to do with checking that item 1 in the list is a member of the tiles group. It runs fine without it, albeit still incorrectly (it's draws a small dot that's completely off on the player's position).

2
Ask a Question / Re: Raycasting Help
« on: January 28, 2021, 07:59:32 pm »
The major difference between your code and mine is that your raycast is based off a static entity, whereas mine is being done from a constantly moving one, the player. The static values you have set for x2 and y2 don't work in my case. Trying to run what I believe is the corrected variation of your code crashes instantly.
To elaborate what I am trying to do, I need the game to constantly be checking where the player is pointing and marking the x and y coordinates of the first object in the player's line of sight, be it tiles or actors. As another side note, I am having issues trying to figure out the coordinates that should be entered if the player is looking at a 45 degree angle, as the x and y location of the line would be different from a simple check of the scene's height/width. If that's too much of an issue for this thread I'll make a separate one for it.

3
Ask a Question / Re: Raycasting Help
« on: January 27, 2021, 04:19:33 pm »
I'll bump this thread one last time, I'm not finding any solutions and the answers provided by merrak did not solve the issue.

4
Ask a Question / Re: Raycasting Help
« on: January 18, 2021, 04:16:22 pm »
I could still use some help on this, I'm completely lost.

5
Ask a Question / Re: Raycasting Help
« on: January 17, 2021, 01:29:11 pm »
The camera for the scene in question is static; that shouldn't be affecting anything in this instance.

6
Ask a Question / Re: Raycasting Help
« on: January 17, 2021, 11:40:56 am »
I believe I'm formatting that equation correctly, but it still isn't doing what it's supposed to. The line still stops at random points (albeit different ones from before) and still travels through the same tiles.

7
Ask a Question / Re: Raycasting Help
« on: January 17, 2021, 07:00:44 am »
Tiles can be tricky to work with because the individual collision bounds of tiles are merged into larger polygons. Turn on debug draw to see where these are. There is a parameter you can use to compute the position where the collision occurs along the line segment from the origin to the end. I don't remember off the top of my head what that is. Do you have documentation for the extension?
It's not much but yes. The block I'm using is the last one he describes.
Quote
This extension provides three blocks:

1. "first actor on line" returns the first actor hit on the line (the actor nearest to x1, y1). If no actor is hit, it will return null.

2. "all actors on line" returns a list of all actors hit on the line, in order of first hit to last hit.

3. "ray cast" returns a list of raycast results, in order of first hit to last hit. Each result is its own list containing:
   0. The B2Fixture hit.
   1. The actor the fixture belongs to.
   2. The x of the collision.
   3. The y of the collision.
   4. The x normal of the collision.
   5. The y normal of the collision.
   6. The fraction along the line at which the collision occured.

8
Ask a Question / Raycasting Help
« on: January 16, 2021, 09:07:46 pm »
I have been using the raycast extension provided here (http://community.stencyl.com/index.php/topic,16734.0.html) to provide coordinates for an instant-traveling projectile. It should be able to detect actors and terrain as well as their current x/y location. However, the coordinates it provides seems to be nonsensical.
It will detect regions correctly, and the debug line I have been drawing to determine where it starts/stops ends in the correct location when it first makes contact with it.
Code: [Select]
Source/scripts/ActorEvents_14.hx:473: [[B2Fixture,[Actor 0,LoadParkourTest],10,896,10,0,0.966777408637874],[B2Fixture,[Actor 0,LoadParkourTest],10,896,10,0,0.966777408637874]]
However, colliding with tiles is a tossup. Sometimes it will travel through several tiles, come out on the other side, and then provide the coordinates it exited the tile from...
Code: [Select]
Source/scripts/ActorEvents_14.hx:473: [[B2Fixture,[Actor 100000000,Terrain],704,639,10,0,0.366336633663366],[B2Fixture,[Actor 100000000,Terrain],0,639,10,0,1]]
...or just ignore all the tiles outright until it hits the edge of the screen, despite being adjacent to the tiles it just collided with and having no difference whatsoever in what type of tile it is.
Code: [Select]
Source/scripts/ActorEvents_14.hx:473: [[B2Fixture,[Actor 100000000,Terrain],620,0,0,10,1],[B2Fixture,[Actor 100000000,Terrain],620,256,0,10,0.666666666666667]]
If the raycast goes offscreen, the game crashes, even though it's set to end at the edge of the screen.
None of this is making any sense to me. This extension is several years old, so is it possible that it's too deprecated to work properly with modern Stencyl?

9
Ask a Question / Re: Pulling data from nested lists(?)
« on: January 16, 2021, 09:00:14 pm »
Thanks, this works, although you have the item numbers reversed; it should be "get item 2/3 from item 0 in list" instead.

10
Ask a Question / Pulling data from nested lists(?)
« on: January 16, 2021, 07:26:55 am »
I am currently working with the raycast extension provided here (http://community.stencyl.com/index.php/topic,16734.0.html), and so far it is returning the values I need from it (the x and y coordinates of the first object it hits). However, I am unable to properly access these values from the list it creates.
Here is an example of the raycast making contact with a tile:
Code: [Select]
Source/scripts/ActorEvents_14.hx:465: [B2Fixture,[Actor 100000000,Terrain],491.692307692308,256,0,10,0.692307692307692]
This is what it prints out when it makes contact with multiple tiles/actors:
Code: [Select]
Source/scripts/ActorEvents_14.hx:239: [[B2Fixture,[Actor 30,Corner Detection],576.5,896,10,0,0.559587471352177],[B2Fixture,[Actor 0,LoadParkourTest],9.99999999999998,896,10,0,0.992360580595875],[B2Fixture,[Actor 0,LoadParkourTest],9.99999999999998,896,10,0,0.992360580595875],[B2Fixture,[Actor 100000000,Terrain],896,896,10,0,0.315508021390374],[B2Fixture,[Actor 100000000,Terrain],576,896,10,0,0.559969442322384]]
And here is the readme portion for the block I am using:
Quote
3. "ray cast" returns a list of raycast results, in order of first hit to last hit. Each result is its own list containing:
   0. The B2Fixture hit.
   1. The actor the fixture belongs to.
   2. The x of the collision.
   3. The y of the collision.
   4. The x normal of the collision.
   5. The y normal of the collision.
   6. The fraction along the line at which the collision occurred.
From what I can tell, it is nesting lists inside each other. How would I pull data from a list inside an existing list instead of just pulling an entire list and having it return null/unusable values?

11
Firing an actor at a fast speed doesn't get the results I need. Setting it to 500 is not instantaneous travel and causes a noticeable delay. Setting it to 999 causes it to travel faster than the game updates and only gets detected as colliding with a tile/actor either when its past it already or five tiles deep.

12
Ask a Question / Immediately determine nearest tile in travel direction
« on: January 01, 2021, 12:23:32 pm »
If I'm creating an actor that has instant movement from one point to another (in this context, a projectile that has instant contact from firing to wherever it's being aimed at), how would I determine which tile/actor is in its travel path? My idea was to draw a straight line from the origin of the actor until it makes contact with something, then use the coordinates from where it made contact, but I have been unable to figure out the best method for doing it, and it also seems like there would be an easier way to do so.

13
Ask a Question / Re: Ledegrabbing by using regions and collision boxes
« on: December 12, 2020, 08:57:33 pm »
Very in-depth and descriptive post, thanks!

14
Ask a Question / Ledegrabbing by using regions and collision boxes
« on: December 11, 2020, 07:08:05 pm »
I am attempting to create a ledgegrab mechanic, but I am unsure of the whole process. The way I would like to do it would be to create two 1x1 hitboxes on the player actor and individual 1x1 regions on each tile corner in the scene they can ledgegrab onto. However, actor regions and scene regions seem to be incapable of interacting with each other, unless I'm missing something obvious. There is also the usage of actor collision points, but the block guide and Stencylpedia is not very descriptive of what they are or what they do, i.e. what tile data is and how it should be used. Is there an example of what would go in tile data that could tie into a ledgegrab mechanic?

15
Thanks, it's working now! I still don't exactly understand how that fixes the issue though, how does having it constantly set to false affect whether or not they're against a wall, even though the other variables that it needs are both being set correctly?

Pages: 1 2