Announcement

Collapse
No announcement yet.

Unreal.js

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Trying to get the editor extension example working - how to I get it to run? I tried attaching to actor, but that doesn't seem to work (not sure why it would).

    Also can this be used to make plugins that could be sold on the marketplace?

    Comment


      Where is the actual installation instruction? Can't find it.

      Comment


        [MENTION=33973]nako_sung[/MENTION] -- just a quick question, could I use the web-socket support inside of Unreal.js to talk to a web-socket enabled web-based application either outside of Unreal or inside of Unreal using the UMG Web Browser Widget?
        Quinton Delpeche
        Founder - Gobbo Games | Designer - The Colony 2174 (Board Game) | Developer - Riders of Asgard

        Comment


          [MENTION=22376]qdelpeche[/MENTION] Yes. you can use websocket but its api is not compatible with web browsers. (currently websocket is only available in windows platform)

          Comment


            [MENTION=33973]nako_sung[/MENTION] - Very amazing work. Related to the concept of compatibility with web browsers, is there any planned added support for live JS interaction with HTML5 exported builds? This would be amazing.

            Thanks for your hard work!
            Last edited by a1programmer; 07-29-2016, 09:05 AM.

            Comment


              [MENTION=169790]a1programmer[/MENTION] For now I have no plan for supporting HTML5, but it seems promising.

              Comment


                I am trying to use this awesome plugin with UE4.13 Preview 3. I get these compile errors:

                ...Plugins/UnrealJS/Source/JavascriptWebSocket/JavascriptWebSocket.h(23): error : UFUNCTION inside this preprocessor block will be skipped
                ...Plugins/UnrealJS/Source/JavascriptWebSocket/JavascriptWebSocketServer.h(20): error : UFUNCTION inside this preprocessor block will be skipped

                Any Suggestions ?

                Thanks.

                Comment


                  [MENTION=2466]dsanjit[/MENTION] Support for 4.13 is updated.

                  Comment


                    Thanks [MENTION=33973]nako_sung[/MENTION] ! Works like a charm !

                    Comment


                      How do I do a line trace by channel in Unreal.JS? I keep getting "Error: Should write into array by passing an array instance". Here is my code:

                      //simplified raytrace, trace from player camera traight forward 5000 cm
                      //cast this.myCamera into CameraComponent for autocomplete features in Visual Studio Code
                      let tempCamera = CameraComponent.C(this.myCamera)
                      //get camera world location
                      let tempStartTrace = tempCamera.GetWorldLocation()
                      //end location is start location + 5000 cm unit forward
                      let tempEndTrace = tempStartTrace + tempCamera.GetWorldRotation().GetForwardVector()*5000

                      //trace
                      let tempHitResult = HitResult.MakeHitResult()
                      let tempBool = false
                      GWorld.LineTraceByChannel(tempStartTrace, tempEndTrace, 'TraceTypeQuery1', false, this, 'ForDuration', tempHitResult, true, LinearColor.MakeColor(1, 0, 0), LinearColor.MakeColor(1, 0, 0), 3)

                      Comment


                        Required var type of 5th parameter is `const TArray<AActor*>& ActorsToIngore`. So you should pass `[this]` instead of `this`.

                        Comment


                          [MENTION=33973]nako_sung[/MENTION]. Ah, yep that fixes it. Thank you very much. I also had an error when calculating the tempEndTrace. The final code for single line trace is:

                          //simplified raytrace, trace from player camera traight forward 5000 cm
                          //cast this.myCamera into CameraComponent for autocomplete features in Visual Studio Code
                          let tempCamera = CameraComponent.C(this.myCamera)

                          //get camera world location
                          let tempStartTrace = tempCamera.GetWorldLocation()

                          //end location is start location + 5000 cm unit forward
                          let tempOffset = tempCamera.GetWorldRotation().GetForwardVector()
                          tempOffset = tempOffset.Multiply_VectorFloat(5000)

                          let tempEndTrace = Vector.Add_VectorVector(tempStartTrace, tempOffset)

                          console.log(tempStartTrace.ToString(), " + ", tempOffset.ToString(), " = ", tempEndTrace.ToString())

                          //trace ForDuration {OutHit: HitResult, $: boolean};
                          let tempHitResult = HitResult.MakeHitResult()
                          let tempBool = false
                          GWorld.LineTraceByChannel(tempStartTrace, tempEndTrace, 'TraceTypeQuery1', false, [this], 'ForDuration', tempHitResult, true, LinearColor.MakeColor(1, 0, 0), LinearColor.MakeColor(1, 0, 0), 3)

                          console.log("hitresult = ", tempHitResult.bBlockingHit)

                          Comment


                            Is there anyway to access the FMath library inside of javascript? Running a code similar to
                            Code:
                            FMath::Rand()
                            .

                            Comment


                              [MENTION=47360]kelfire[/MENTION] you have Math.random(), it is a native js-function. If you want some more, you can grab some nice js modules via npm. For example there is nice scientific math library available (https://github.com/numjs/numjs).

                              Arithmetic operations should be kept in pure js in order to achieve good performance.

                              Comment


                                [MENTION=33973]nako_sung[/MENTION] Yep, I was using some of the Math javascript functions. I thought it might be faster to switch to the Unreal C++ math. I didn't know it is actually faster to use javascript math functions. The numjs library looks really good, I'll book mark it future. Thank you.

                                Comment

                                Working...
                                X