This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Sid": "AllowIamUserAssumeRole", | |
"Effect": "Allow", | |
"Action": "sts:AssumeRole", | |
"Principal": {"AWS": "arn:aws:iam::123456789012:user/external-user"}, | |
"Condition": { | |
"StringEquals": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function setup(args, ctx) { | |
// This is a HTMLVideoElement that is powering the video texture for the current entity | |
// You can use any standard method on the Video element. See the docs here: https://developer.mozilla.org/en-US/docs/Web/API/HTMLVideoElement | |
// The following example uses the 'Space' key to toggle play/pause | |
ctx.video = ctx.entity.meshRendererComponent.materials[0].getTexture("DIFFUSE_MAP").image; | |
ctx.onKeyDown = (e) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This will override an internal method of the sumerian lex actions | |
// This override is NOT guaranteed to work as we upgrade engine versions, but works with some limited testing with Sumerian 0.18 | |
// In the following version, the code is exactly what we have in the engine, with the addition of the 'sessionAttributes' property | |
// Any parameter supported by PostContent in the Lex API documentation may be added here, specifically `requestAttributes` and `sessionAttributes` | |
// See more here: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/LexRuntime.html#postContent-property | |
// | |
// Add this in a script before executing a lex action | |
// You may execute this whenever updating session attributes OR you may pull from other global data from within this function | |
// Do not change any of the other parameters, or the Lex actions likely won't work | |
sumerian.api.aws.lex.LexProcessingAction.prototype._getLexConfig = function(entity, inputStream) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const material = ctx.entity.getComponent("MeshRendererComponent").materials[0]; | |
new sumerian.TextureCreator().loadTexture2D("https://images-na.ssl-images-amazon.com/images/G/01/support_images/GUID-15BCCE28-8970-45C8-BF29-5F9FBF2293B5_en-US.png").then(texture =>{ | |
material.setTexture("DIFFUSE_MAP", texture); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//To pass in parameters to your Sumerian scene at load time, you may use query parameters | |
//Link to your scene like this: https://SCENEID.us-east-1.sumerian.aws/? | |
//Now in your script code: | |
const params = new URLSearchParams(window.location.search); | |
//prints 'value1' | |
console.log(params.get("key1")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
// Paste this script into a script component to use | |
const start = Date.now(); | |
const nLin = 100; | |
const nCol = 30; | |
function getMatrix() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Put the below in a script in the ScriptComponent attached to the host entity | |
//It must be attached to the host entity so that `ctx.entity` below refers to the host | |
//If this script is attached elsewhere, the lip syncing will not work | |
const speech = new sumerian.Speech(); | |
speech.body = "The sentene to be spoken by the host"; | |
speech.type = 'ssml'; | |
// This sets up the entity so the right ssml events fire (We can make the host lip sync and move) | |
speech.updateConfig({ entity: ctx.entity }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: API Gateway Request Model Validation using Lambda Proxy Integration | |
Resources: | |
ApiGatewayApi: | |
Type: AWS::Serverless::Api | |
Properties: | |
DefinitionBody: | |
swagger: 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Description: API Gateway Request Model Validation using Lambda Proxy Integration | |
Resources: | |
ApiGatewayApi: | |
Type: AWS::Serverless::Api | |
Properties: | |
DefinitionBody: | |
swagger: 2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require("aws-sdk"); | |
var docClient = new AWS.DynamoDB.DocumentClient() | |
//Create a Translator object, which comes from the DocumentClient | |
var dynamodbTranslator = docClient.getTranslator(); | |
//It needs a SDK 'shape'. The individual Items in the Stream record | |
//are themselves the same Item shape as we see in a getItem response | |
var ItemShape = docClient.service.api.operations.getItem.output.members.Item; |
NewerOlder