cjbruce's Recent Forum Activity

  • It is quite possible that what you have is okay, but I did notice two things:

    1. Dot product will only evaluate from -1 to +1 if you normalize the vectors first. Since you haven't done this (and don't really need to), what you are seeing is the expected result. Since all you need is a number greater than 0, you should be fine.

    2. Is the enemyFacing vector a position or a direction? If it is a direction, then you don't need to subtract the enemy's position from it to get dot2. If it is a position, then you are computing v2 correctly.

    I'm not sure if dot1 and dot2 are being calculated directly, but from the numbers you have in the screenshot, they are both pointing roughly in the same direction. Their x and y components both have the same sign. The dot product should evaluate to be >0.

  • I think a Dot Product would do the trick. Take the Dot Product of the surface normal and the direction to the player. If it is >0, then it is facing the player.

  • You can do it like this, it converts the binary to base64, downside is a larger filesize.

    For Snapshots

    For DrawingCanvas Snapshots

    The YOUR_SERVER.com/snapshot.php

    It works! Base64 isn't an issue, and I switched over to image/jpeg to cut down on the file size. The pngs were huge, but .jpg makes things a whole lot faster.

  • Still no luck. I've tried everything I can think of:

    1. Getting the contents of the raw binary in php using $data = file_get_contents('php://input'). This gets me a string of garbage that I can't figure out how to use.

    2. Sending a standard POST with AJAX with "data="&URLEncode(BinaryData.GetBase64) in the Data field. I have then been able to successfully decode bits of the image using php. The result is some of the pixels being the right color, but the overall image seems to be compressed into a narrow strip at the top.

    #2 is the closest I've come, and I'm out of ideas. Is there anyone out there who has successfully uploaded an image to a php server?

  • Ashley, thanks again for your help on this.

    I'm not sure what I'm doing wrong, but on the server side the php script sees an empty $_POST[] array.

    1. Should this array be populated with a Base64 encoded version of the image?

    2. The "POST" method in the Construct 3 AJAX object doesn't allow you to set a key. Does the AJAX object in Construct 3 set a key automatically? I believe there should be a key->value pair received by the php server. Maybe I need to Base64 encode the image first, then send it via a standard AJAX post?

    --------------------

    Here's my event sheet:

    + DrawingCanvas: On saved image

    -> previewSprite: Load image from DrawingCanvas.SavedImageURL (Resize to image size, cross-origin anonymous)

    -> maskSprite: Set animation frame to 0

    -> DrawingCanvas: Clear canvas rgba(0, 0, 0, 0)

    -> AJAX: Set response binary to BinaryData

    -> AJAX: Request DrawingCanvas.SavedImageURL (tag "Step 1")

    + AJAX: On "Step 1" completed

    -> AJAX: Send BinaryData to URL "../upload.php" (method "POST", tag "Step 2")

    -> Browser: Alert "Posting "&BinaryData.GetText(0,BinaryData.ByteLength)&" to server."

    + AJAX: On "Step 2" completed

    -> Browser: Alert AJAX.LastData

  • You can't send the saved image URL. It refers to local data so the remote server will not be able to access it.

    Use AJAX to first load the Drawing Canvas in to a Binary Data object, and then send the Binary Data to your server.

    Ashley Thank you for this! I'm a little dense, but I'm not following what the event structure would be for this. Is there an example online that I have missed?

    EDIT: Under "ajax", I see the following:

    Step 1 - Which one works for loading the Drawing Canvas to the Binary Data object?

    Step 2 - I'm assuming I can use "Post Binary to URL" once the Binary Data object's buffer has been populated.

  • I am looking to create an app where you can upload your composited drawings.

    So far my thinking goes as follows:

    1. When you click the "Upload" button, you save the current image on the DrawingCanvas.

    2. Use the Ajax object to upload the DrawingCanvas.SavedImageURL.

    3. Use php to get the contents at that URI.

    Here's what I have in the event sheet:

    Here's my php:

    The files saved on the php server contain zero bytes of data.

    Any thoughts?

  • There may yet be hope for 3d inside construct. This looks promising. https://mitsu-studios.itch.io/3djs

    mOOnpunk, thank you for keeping tabs! My pipe dream is to port our Unity game to Construct 3. It looks like this project is bringing the dream a little closer.

  • Has anyone released anything using this plugin? I tinkered with it some but didn't know how viable it was to invest time in figuring it out without having some idea of what people are doing with it? Are folks able to port to mobile apps with this or perhaps it's reliant on browsers to interact with correctly?

    Yes. We did “Robot Rumble” for the AirConsole game contest 2 years ago. It wasn’t commercially viable, earning a total of about $35 the first year. My biggest issue with Q3D is that it is no longer supported. It was fun to play with, but no support or further development is the death knell for a commercial project.

    I love the idea of browser based games. Unfortunately, people expect the web to be free and aren’t willing to pay enough to support developers to keep developing.

    If you are interested in making mobile 3D games commercially as a small developer, it is hard to beat Unity3d. Their HTML5 export is terrible, and their mobile HTML5 export is nonexistent. For us, Unity was the clear choice when we decided against HTML5 as the target platform for our next 3D game.

    If you are worried about the “no coding” dream of Construct + Q3D for mobile, I strongly suggest looking at Unity instead. You will waste so much time trying to get a very limited 3D feature set working for mobile using Q3D, and have something working out of the box in Unity in almost no time at all.

    I would love to do a mobile HTML5 port someday using Construct3, but the 3D plugins don’t exist yet.

  • Hello. Is this plugin compatible with Construct 3? I know I may be answering a question already answered, but personally, I would prefer to ask rather than ramble through 100-1000 pages of topic only to find nothing on the subject. Thanks in advance anyway. ^-^

    Unfortunately, no. Several of us are eagerly awaiting a 3D solution for Construct 3.

  • Agreed. Q3D gave the option of doing it either way. For our Q3D game “Robot Rumble”, we ended up placing the three.js canvas behind for performance reasons.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok, my first 3D-Test works now (uploading later). Currently i'm use three.js, but the next step is: i'm testing the same with babylonjs.

    Nice! I'm looking forward to seeing how this goes.

    My dream is to someday be able to draw triangles in 3D in Construct 3.

    My completely ridiculous dream is to port our current Unity3D game to Construct 3. Its an extremely long shot, but it would be really cool to prove out the viability of Construct 3/HTML5. Unity's HTML5 implementation is still pretty much nonfunctional for my purposes.

cjbruce's avatar

cjbruce

Early Adopter

Member since 25 Apr, 2013

Twitter
cjbruce has 4 followers

Connect with cjbruce

Trophy Case

  • 11-Year Club
  • Forum Contributor Made 100 posts in the forums
  • x3
    Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

17/44
How to earn trophies