Skip to content
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

Merged
merged 6 commits into from Jun 24, 2022
Merged

Vehicle Animation 1.0 #182

merged 6 commits into from Jun 24, 2022

Conversation

srothst1
Copy link
Collaborator

@srothst1 srothst1 commented Jun 17, 2022

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 string animated. For instance, we have:

  {
    "width": 9,
    "variantString": "outbound|car|animated",
    "type": "drive-lane"
  }

Here are some relevant resources that I have used:

@srothst1 srothst1 self-assigned this Jun 17, 2022
@srothst1 srothst1 added this to In progress in 3DStreet Tracking Jun 17, 2022
@srothst1
Copy link
Collaborator Author

Screen Shot 2022-06-17 at 3 16 10 PM

Here is a video showcasing the vehicle animations: https://youtu.be/kUgoRIKC6nA

@srothst1 srothst1 marked this pull request as ready for review June 17, 2022 22:32
@srothst1 srothst1 requested a review from kfarr June 17, 2022 22:32
@srothst1
Copy link
Collaborator Author

Hi @kfarr 👋 Please take a look at this when you get the chance.

@kfarr kfarr moved this from In progress to For Review in 3DStreet Tracking Jun 21, 2022
@@ -294,7 +294,17 @@ function createBusElement (isOutbound, positionX) {
return busParentEl;
}

function createDriveLaneElement (variantList, positionX, segmentWidthInMeters, length) {
function createDriveLaneElement (variantList, positionX, segmentWidthInMeters, length, animated = 'false') {
Copy link
Collaborator

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)

Copy link
Collaborator Author

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 👍

@@ -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);
Copy link
Collaborator

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
Copy link
Collaborator

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very speedy 🐎

@kfarr
Copy link
Collaborator

kfarr commented Jun 24, 2022

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

@srothst1 srothst1 merged commit 96c7cfe into main Jun 24, 2022
@srothst1 srothst1 deleted the vehicle-animation-1.0 branch June 24, 2022 17:09
@srothst1
Copy link
Collaborator Author

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.

Screen Shot 2022-06-24 at 10 15 25 AM

This seems a little bit high to me, but I would be curious to see how the animation looks.

@kfarr kfarr moved this from For Review to Done in 3DStreet Tracking Jun 24, 2022
@srothst1
Copy link
Collaborator Author

There should be one full wheel rotation every 02.60869 seconds. This rate is that of a car that is navigating at 1 m/s.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants