Rhindon's Forum Posts

  • Usually you don't need for each for object container. Instead set the action directly to respective other object container.

    Normally, I would agree and have thought the same thing. But I've found that that doesn't always seem to be the case. I've had a hard time discerning when I do and don't need to specify literally for each container instance.

    Sadly, the problem persists. The second container group (the one on the right) doesn't all line up correctly.

  • The two images here are the event sheet line items and a screenshot of the results during a preview.

    I have three objects in a container:

    Spring_Pole (silver gradient object)

    Spring_Board (red & white 3D object)

    Spring_Trigger (yellow square)

    In the preview screenshot, the Spring on the left has all three components correctly aligned.

    But the Spring on the right has the Spring_Trigger not lining up with the Spring_Board properly.

    Since they're all in a container, I'm doing the For Each condition line. I have verified that the angles all are as they should be...it's just the position of the one Spring_Trigger object that won't line up properly - it should be just to the left of the Spring_Board.

    In the layout, I only have the Spring_Boards (two of them) as I expect the Pole and Trigger will auto-spawn for each Board.

    What am I missing? Any suggestions?

    Thank you for your help.

  • Video reference:

    Subscribe to Construct videos now

    It will be easier to see the blue line if the video is full-screen.

    (If the video player doesn't load: https://youtu.be/EUgaWhvBWq8.)

    When I start up my game's preview, there is a "blink and you miss it" flicker of a blue line on what could be described as the "horizon" of the layout with the 3D camera being utilized.

    I've had this problem before but couldn't identify its cause. One thing I can confirm through prior testing is that this line isn't actually "in the distance" as it always appears in front of other objects regardless of their Z Height and XY distance from the Camera. So, it seems to be more of a visual "tick". I just don't know what's causing it or how to fix it.

    Here is a link to my current project as it is now: https://drive.google.com/file/d/1Sg3iKvcTe7-oL4_H-mEdtvIMj_Lov4Qk/view?usp=sharing.

    The Camera_Base object is what I'm using to better manipulate the position of the 3D Camera object. Its setup starts at Event Line 29. I believe that's all that is relevant in the event sheet.

    I also just switched the Z Axis Scale value in the project properties window from "Normalized" to "Regular". I did this because I wanted to be able to better match the Z Height values to the Width/Height values of certain objects and I figured it would be easier to do this than to guess what value on a 0-100 scale works with the sizes on the regular XY scale.

    I hope that helps narrow down the details. Thanks for any help you might be able to offer.

    Tagged:

  • I'm baffled by what I'm seeing here...

    NOTE: You will need to click on the image to see the line in question better.

    It appears to be a blue line where I believe the edge of the layout border to be.

    The 3D camera is positioned just above the layout in a rather 3d-person perspective and it flickers occasionally as I move my green circle character around and rotate the camera around behind it. I have to get the position just right to get the blue line to appear but I'm not sure what it is...

    Interestingly, as you can see, it's appearing in front of those green towers (those are 3D cubes that I'm getting set in place). I was going to use these towers to block the blue line if it was, indeed, in the distance, but it still appears in front of the 3D blocks (visually more so than spacially).

    When I had the 3D camera positioned higher, I never saw this happen. Also, I did recently double the size of the layout from 1500x1500 to 3000x3000.

    Any idea what's causing this?

  • I have a 3D shape that is using a sprite image on its faces. The 3D shape is part of a container, so when the other container objects meet certain conditions, I want to have the animation of the sprite attached to the respective 3D shape instance updated accordingly.

    However, all I can manage to do is update the sprite's animation which causes all 3D shapes using that sprite image to animate when only certain 3D shape instances ought to animate (with the sprite, that is).

    Despite the fact that the 3D shape is part of the container, I cannot figure out how to update the sprite image animation of only that 3D shape instance when its container objects meet certain conditions.

    There is no 3D shape "face animation" action or otherwise that I can find. And the manual entry 3D shape offers no clear information that I could find.

    Are there any suggestions or solutions I have missed?

    Thanks!

  • R0J0hound - Ooooh, snap, I think you're right. I totally forgot there even was an anglelerp. And I agree about the 0-seam you mentioned. That does seem to be precisely the case.

    Thank you, good sir!!

    Your help is always invaluable and appreciated.

  • PROJECT

    I'm attempting to make a simple "open world" racer with a 3D camera pinned behind the Car object. The 3D Camera (hereafter, Cam) is attached to an Arm sprite object (a long, thin rectangle) at image point 1. The Arm's origin point is at the far right of the sprite and image point 1 is at the first left. The Cam is pinned to the Arm and the Arm is pinned to the Car

    The idea is that as the Car moves along (using the Car behavior, naturally), the Cam will be dragged along. An event line will have the angle of the Arm set to a fraction of its current angle between itself and the Car's Car.MovingAngle via lerp.

    EVENT-> ACTION: Set Arm.Angle to lerp( Self.Angle , Car.Car.MovingAngle , 0.03 )

    IMAGE 1: The Car (black rectangle with the green triangle) connected to the Cam (blue image) via the Arm (red, dotted line). The red dot on the Arm is the origin point and the white dot on the blue Cam is image point 1.

    IMAGE 2: The Arm rotates so that it is the same angle as the Car via lerp. The Cam is always facing the Car.

    IMAGE 3: The Arm is limited to a range it can go regardless of how intense the Car turns.

    Now, for the practical part, this works. As the Car turns and drifts, the Arm is "rotated" gradually and relative to the angle and closes the gap so that the angle of the Arm becomes (virtually) zero-sum to the Car.Angle.

    PROBLEM

    The issue I'm having is that if I maintain a constant turn/drift, the turning rate will overtake the Arm and it will look like the Car does a massive spinout. I attempted to use a clamp() expression...

    clamp( Arm.Angle , Car.Car.MovingAngle - 45 , Car.Car.MovingAngle + 45 )

    But for some reason, this results in a similar issue. The Arm will "lock" against the clamp() range limit but if the turning rate of the Car is still too much, it will "clip" as if breaking past the boundaries of the clamp() and spinout again.

    GOAL

    The ultimate goal I'm trying to accomplish is to get the Cam to "dynamically" and smoothly update its position while maintaining an overall behind-the-Car fixed area.

    Any suggestions would be greatly appreciated. Thank you!

    Tagged:

  • OH MY GOODNESS!! That may just be the solution (the Dropbox example)!!

    Yeah, the use of 8 Direction is because of my need to have a check against objects with the Solid behavior. The custom movement system I had before was similar to the trig solution you've provided (setting movement angle to +/-90, et al).

    Since going back to using 8 Direction, the whole problem was trying to get the keyboard input to reflect the 3D camera perspective (and therefore the facing angle of the Player) while taking into account that 8 Direction does not normally regard the camera perspective. That's why your trig solution was so pivotal.

    However, using the "ghost sprite" object is genius! I'm going to work on adapting that now. I think you just solved the problem.

  • R0J0hound - As always, you are a lifesaver. Can't tell you enough how grateful I am for your help. THANK YOU.

    It's a funny thing (to me) - your explanations made sense on their own but when it came to applying them, I kept getting lost on details and I couldn't exactly articulate what those details were. But I finally got it! Some of it was just the logic order of the conditions/actions in light of all the trig calculations. Along with some extra review (thank you, Google), I was better able to understand what you were getting at.

    ANYWAY! Enough sentimentalism...

    Here's what I plugged in and it WORKS! (I'm 41 and feeling like a kid who just his Lego set put together. Good stuff.)

    Now, I'm not sure this was exactly what you had in mind, so if there is a more refined way of doing this, I'm not seeing it. The next step I need to do is to see if I can figure out how to make moving in diagonals possible. I believe this is what you meant by adding velocities together. I updated the logic to apply the trig calculations directly the 8 Direction behavior's velocity values instead of the instance variables I had been using (I think that was lending itself to some of my initial hang-ups).

    I think I need to try to think outside the box to figure this one out on my own. I will request some extra help if I can't figure it out for some reason.

    Thank you again!

  • R0J0hound - I realize I have a tendency to over-explain everything. LOL

    So, hopefully, this better summarizes what my last comment was trying to get at.

  • For the most part, I think I follow... But I have some clarifying questions.

    You can set the velocity in a specific direction with a bit of trig:

    Vx=100*cos(a)

    Vy=100*sin(a)

    To reword this in my own head (and how I am currently plugging into my project) in order to make sure I understand:

    Player.Velocity_X = Player.8Direction.MaxSpeed * cos( Player.Angle )
    Player.Velicity_Y = Player.8Direction.MaxSpeed * sin( Player.Angle )
    

    Then to limit the max speed you can do this

    Speed=distance(0,0,vx,vy)
    If speed>maxSpeed then
    — vx = vx/speed*maxSpeed
    — vy = vy/speed*maxSpeed
    1. Set (instance) variable Speed to the distance between coordinate (0,0) and (Player.Velocity_X , Player.Velocity_Y)
    2. If Player.Speed is greater than the Player.8Direction.MaxSpeed then...
    3. - Set Velocity_X to Velocity_X divided by Speed times MaxSpeed
    4. - (Do the same for Velocity_Y)

    Now, all of that I think I follow and I've got the variables plugged in.

    But I have two questions I'm having trouble figuring out...

    1. Why is Speed=distance(0,0,vx,vy) starting at (0,0)? Or should I just replace that with the Player's X/Y coordinates?

    2. Once I have Velocity_X and Velocity_Y set - I realize this may be a "DUH" answer - what do I do to use them? Like, where do they go in the event sheet after that? Say I just want to do Hold W to move forward, how do I type that up in the event sheet?

  • You can set the velocity in a specific direction with a bit of trig:

    As always, you are among the awesome people who come to the rescue. THANK YOU! I remember having only a semester of trig in high school (c/o 1999... I'm old-ish LOL). So, trig didn't immediately come to mind. But it makes sense now that it would apply.

    I'll work on adapting your solution after work today and let you know if that resolves the problem. Thanks again! God bless!

  • PROBLEM I need some help on how to calculate the proper X and Y speed in the 8 Direction behavior relative to the facing direction of the object.

    TYPICAL SCENARIO In a traditional 2D game with the 8 Direction behavior, pressing the Up arrow moves object up on the Y axis...etc, etc, etc. And doing so moves the object according to the given (max) speed set in the parameters.

    If, for example, you press up and left, the object will move up and left at the same pixels-per-second speed defined.

    CURRENT SCENARIO IN DETAIL I have the 3D camera set behind my Player object in a 3rd-person-shooter perspective. Using the Mouse, you can make the Player rotate its facing angle left or right. The goal is to use the WASD keys (or arrow keys but I'm using WASD for my project) to the Player forward & back and strafe left & right.

    Now, naturally, 8 Direction operates from within the fixed 2D plane of the layout. It does not factor in the 3D camera. So if the 3D Camera, fixed behind the Player's head at all times, is facing down (towards the bottom of the layout), pressing W will make the Player appear to move backward, even though from the camera perspective, one would expect to move forward.

    I am using 8 Direction because of its built-in check to stop when it encounters objects with a Solid behavior. I did have a custom movement system that worked but it failed to work properly when encountering Solid objects.

    ATTEMPTED SOLUTION Instead, I am trying to calculate how much speed to give to the X and Y vectors of 8 Direction (or even two instances of the behavior on the same object - one for X, the other for Y) based upon the facing direction of the Player.

    As you can see in my crude image, the idea is that if the Player is facing a certain direction, pressing W is to make the Player move in that direction and not simply up on the Y axis. (EDIT: I should have drawn the WASD squares correctly orientated to the Player's facing direction and not in line with the X/Y axes. That's my mistake.) Instead, W leads to a calculation that determines the proper speed in pixels/second for both the X and Y axes. If the movement speed for 8 Direction is normally 200, I would need less than 200 for each axes but it would have to be a value that still amounted to 200 total. Otherwise, moving in a diagonal direction would invariably result in the Player moving much faster than 200.

    In this setup, WASD is always relative to the Player's facing direction and not the traditional X/Y axes orientation the behavior is built around.

    ULTIMATE PROBLEM I believe I have the right idea but I am struggling to determine if I need to manipulate the behavior (max) speed, the behavior X/Y vectors, use instances variables for each movement direction (or just two variables for vertical and horizontal movement)... (I would include a screenshot of my current event sheet but I'm in the middle of making edits so I apologize for any confusion on my current efforts at a solution.)

    I am requesting some suggestions or specific solutions I can attempt (I don't mind doing the work but if you have a particular solution in mind, I just need pointed in the right direction), I would be so very grateful. THANKS!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • GOAL

    Using the Absolute X value of the Mouse to determine when to rotate the Player's angle (and thus the 3D camera with it).

    If Mouse.AbsoluteX is less than 1/3 the width of the viewport (layer "HUD", set with a 0x0 parallax and 2D layer rendering) then rotate counter-clockwise.

    If Mouse.AbsoluteX is greater than 2/3 of the viewport, rotate clockwise.

    (In the screenshot, I had this backwards by accident.)

    Now, this WORKS...but with a small catch

    PROBLEM

    When doing a preview play of the game, resizing the preview window affects the viewport width (default 1500 pixels). Even though I tell it to check for 1/3 or 2/3 of the viewport width, regardless the current width of the window/viewport.

    Yet, when I resize it bigger or smaller than what the preview window started at, the two condition lines I highlighted in the first pic still calculate things at 1500 pixels even though, as my second pic points out, the viewport is more than 1500 pixels.

    (When the preview window is resized smaller, thus the viewport is less than 1500 pixels wide, I can't even begin to made it rotate clockwise.)

    In this second image, the preview window is enlarged to fix my monitor's full size. As a result the viewport width is greater than 1600 pixels. This isn't necessarily a problem because the event lines are not looking for specific values but a fraction of a value, whatever that value is at the time.

    The actual problem is that as the viewport, itself, is resized, that new viewport width value does not seem to be taken into account. For example, if I resize the preview window significantly smaller and try to move the Mouse to the far right of the viewport, it will not cause the Player to rotate whatsoever because the viewport is much smaller than 1500.

    When the preview window is close to 1500 pixels (the default value I set in the project parameters), 1/3 of that is 500 and 2/3 of that is 1000. But these values do not register. It's actually at values just a bit less than 500 and 1000 before the appropriate actions take place.

    In the image above, there is a rainbow-colored bar that I was using originally. On it are two small tick marks to denote where the 1/3 and 2/3 portions of the bar are at. These were supposed to be the visual cues (for testing) to let me know where the Player/camera should start rotating clockwise or counterclockwise. However, I discovered that ultimately even the object when used as a reference produced the same problem as using the viewport width as a reference.

    Is this a bug or is there a detail I'm missing?

  • oosyrag - I completely updated my post here to hopefully make it more clear. I also included an updated image that should help things be more understandable as well as a copy of my project file. I hope this helps.