New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vehicle Animation 1.0 #182
Conversation
Here is a video showcasing the vehicle animations: https://youtu.be/kUgoRIKC6nA |
Hi @kfarr 👋 Please take a look at this when you get the chance. |
src/aframe-streetmix-parsers.js
Outdated
@@ -294,7 +294,17 @@ function createBusElement (isOutbound, positionX) { | |||
return busParentEl; | |||
} | |||
|
|||
function createDriveLaneElement (variantList, positionX, segmentWidthInMeters, length) { | |||
function createDriveLaneElement (variantList, positionX, segmentWidthInMeters, length, animated = 'false') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason for a string instead of boolean for animated
? (like 'false'
instead of the false
and elsewhere below 'true'
instead of true
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No good reason - not using a boolean actually makes the code less clean. Just added a commit that changes animated
to a boolean value in createSidewalkClonedVariants
and createDriveLaneElement
👍
src/aframe-streetmix-parsers.js
Outdated
@@ -308,8 +318,33 @@ function createDriveLaneElement (variantList, positionX, segmentWidthInMeters, l | |||
} else if (variantList[1] === 'truck') { | |||
reusableObjectEl.setAttribute('mixin', 'box-truck'); | |||
} else if (variantList[1] === 'pedestrian') { | |||
return createSidewalkClonedVariants(positionX, segmentWidthInMeters, 'normal', length, variantList[0]); | |||
return createSidewalkClonedVariants(positionX, segmentWidthInMeters, 'normal', length, variantList[0],animated); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for thinking to include this!
@@ -295,7 +295,8 @@ function createBusElement (isOutbound, positionX) { | |||
} | |||
|
|||
function createDriveLaneElement (variantList, positionX, segmentWidthInMeters, length, animated = 'false') { | |||
var totalStreetDuration = (length / 5) * 1000; | |||
var speed = 10; // meters per second |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this increases the default speed to 10 m/s ~= 22mph
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very speedy 🐎
Also for future reference here is a way to calculate rotations of wheel relative given a velocity and wheel radius https://www.texasgateway.org/resource/61-angle-rotation-and-angular-velocity#64411 |
Here is another resource that might be helpful: https://www.omnicalculator.com/everyday-life/rpm A 2014 Toyota Camry has tires with a diameter of 32 inches. Thus, if we are traveling at 22mph, our rpm should be roughly 230 according to omnicalculator. This seems a little bit high to me, but I would be curious to see how the animation looks. |
There should be one full wheel rotation every |
The goal of this pull request is to add vehicle animations to the street segments in 3DStreet.
Character animations can be added to the
drive-lane
segment by adding the variant stringanimated
. For instance, we have:Here are some relevant resources that I have used: